Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/en/quantization/torchao.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pipeline = DiffusionPipeline.from_pretrained(
pipeline = DiffusionPipeline.from_pretrained(
"black-forest-labs/FLUX.1-dev",
quantization_config=pipeline_quant_config,
torch_dtype=torch.bfloat16,
dtype=torch.bfloat16,
)
pipeline.to("cuda")
```
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ from diffusers import StableDiffusionImg2ImgPipeline
device = "cuda"
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-v1-5",
torch_dtype=torch.float16,
dtype=torch.float16,
).to(device)

# let's download an initial image
Expand Down Expand Up @@ -160,7 +160,7 @@ mask_image = download_image(mask_url).resize((512, 512))

pipe = StableDiffusionInpaintPipeline.from_pretrained(
"stable-diffusion-v1-5/stable-diffusion-inpainting",
torch_dtype=torch.float16,
dtype=torch.float16,
)
pipe = pipe.to("cuda")

Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/ace_step/pipeline_ace_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _normalize_audio_codes(audio_codes: Union[str, List[str]], batch_size: int)
>>> from diffusers import AceStepPipeline

>>> pipe = AceStepPipeline.from_pretrained(
... "ACE-Step/acestep-v15-xl-turbo-diffusers", torch_dtype=torch.bfloat16
... "ACE-Step/acestep-v15-xl-turbo-diffusers", dtype=torch.bfloat16
... )
>>> pipe = pipe.to("cuda")

Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/allegro/pipeline_allegro.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
>>> from diffusers import AutoencoderKLAllegro, AllegroPipeline
>>> from diffusers.utils import export_to_video

>>> vae = AutoencoderKLAllegro.from_pretrained("rhymes-ai/Allegro", subfolder="vae", torch_dtype=torch.float32)
>>> pipe = AllegroPipeline.from_pretrained("rhymes-ai/Allegro", vae=vae, torch_dtype=torch.bfloat16).to("cuda")
>>> vae = AutoencoderKLAllegro.from_pretrained("rhymes-ai/Allegro", subfolder="vae", dtype=torch.float32)
>>> pipe = AllegroPipeline.from_pretrained("rhymes-ai/Allegro", vae=vae, dtype=torch.bfloat16).to("cuda")
>>> pipe.vae.enable_tiling()

>>> prompt = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@

>>> # Download controlnets from https://huggingface.co/lllyasviel/ControlNet-v1-1 to use .from_single_file
>>> # Download Diffusers-format controlnets, such as https://huggingface.co/lllyasviel/sd-controlnet-depth, to use .from_pretrained()
>>> controlnet = ControlNetModel.from_single_file("control_v11f1p_sd15_depth.pth", torch_dtype=torch.float16)
>>> controlnet = ControlNetModel.from_single_file("control_v11f1p_sd15_depth.pth", dtype=torch.float16)

>>> # We use AnimateLCM for this example but one can use the original motion adapters as well (for example, https://huggingface.co/guoyww/animatediff-motion-adapter-v1-5-3)
>>> motion_adapter = MotionAdapter.from_pretrained("wangfuyun/AnimateLCM")

>>> vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse", torch_dtype=torch.float16)
>>> vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse", dtype=torch.float16)
>>> pipe: AnimateDiffControlNetPipeline = AnimateDiffControlNetPipeline.from_pretrained(
... "SG161222/Realistic_Vision_V5.1_noVAE",
... motion_adapter=motion_adapter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
>>> from diffusers.utils import export_to_gif

>>> adapter = MotionAdapter.from_pretrained(
... "a-r-r-o-w/animatediff-motion-adapter-sdxl-beta", torch_dtype=torch.float16
... "a-r-r-o-w/animatediff-motion-adapter-sdxl-beta", dtype=torch.float16
... )

>>> model_id = "stabilityai/stable-diffusion-xl-base-1.0"
Expand All @@ -96,7 +96,7 @@
... model_id,
... motion_adapter=adapter,
... scheduler=scheduler,
... torch_dtype=torch.float16,
... dtype=torch.float16,
... variant="fp16",
... ).to("cuda")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
>>> vae_id = "stabilityai/sd-vae-ft-mse"
>>> device = "cuda"

>>> motion_adapter = MotionAdapter.from_pretrained(motion_adapter_id, torch_dtype=torch.float16).to(device)
>>> controlnet = SparseControlNetModel.from_pretrained(controlnet_id, torch_dtype=torch.float16).to(device)
>>> vae = AutoencoderKL.from_pretrained(vae_id, torch_dtype=torch.float16).to(device)
>>> motion_adapter = MotionAdapter.from_pretrained(motion_adapter_id, dtype=torch.float16).to(device)
>>> controlnet = SparseControlNetModel.from_pretrained(controlnet_id, dtype=torch.float16).to(device)
>>> vae = AutoencoderKL.from_pretrained(vae_id, dtype=torch.float16).to(device)
>>> scheduler = DPMSolverMultistepScheduler.from_pretrained(
... model_id,
... subfolder="scheduler",
Expand All @@ -85,7 +85,7 @@
... controlnet=controlnet,
... vae=vae,
... scheduler=scheduler,
... torch_dtype=torch.float16,
... dtype=torch.float16,
... ).to(device)
>>> pipe.load_lora_weights(lora_adapter_id, adapter_name="motion_lora")
>>> pipe.fuse_lora(lora_scale=1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
>>> from PIL import Image

>>> adapter = MotionAdapter.from_pretrained(
... "guoyww/animatediff-motion-adapter-v1-5-2", torch_dtype=torch.float16
... "guoyww/animatediff-motion-adapter-v1-5-2", dtype=torch.float16
... )
>>> pipe = AnimateDiffVideoToVideoPipeline.from_pretrained(
... "SG161222/Realistic_Vision_V5.1_noVAE", motion_adapter=adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@
>>> from diffusers import AutoencoderKL, ControlNetModel, MotionAdapter, LCMScheduler

>>> controlnet = ControlNetModel.from_pretrained(
... "lllyasviel/sd-controlnet-openpose", torch_dtype=torch.float16
... "lllyasviel/sd-controlnet-openpose", dtype=torch.float16
... )
>>> motion_adapter = MotionAdapter.from_pretrained("wangfuyun/AnimateLCM")
>>> vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse", torch_dtype=torch.float16)
>>> vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse", dtype=torch.float16)

>>> pipe = AnimateDiffVideoToVideoControlNetPipeline.from_pretrained(
... "SG161222/Realistic_Vision_V5.1_noVAE",
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/anyflow/pipeline_anyflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
>>> from diffusers.utils import export_to_video

>>> pipe = AnyFlowPipeline.from_pretrained(
... "nvidia/AnyFlow-Wan2.1-T2V-14B-Diffusers", torch_dtype=torch.bfloat16
... "nvidia/AnyFlow-Wan2.1-T2V-14B-Diffusers", dtype=torch.bfloat16
... ).to("cuda")

>>> prompt = "A red panda eating bamboo in a forest, cinematic lighting"
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/anyflow/pipeline_anyflow_far.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
>>> from diffusers.utils import export_to_video, load_image

>>> pipe = AnyFlowFARPipeline.from_pretrained(
... "nvidia/AnyFlow-FAR-Wan2.1-1.3B-Diffusers", torch_dtype=torch.bfloat16
... "nvidia/AnyFlow-FAR-Wan2.1-1.3B-Diffusers", dtype=torch.bfloat16
... ).to("cuda")

>>> # Single-frame I2V: wrap the conditioning image as a (1, 1, 3, H, W) tensor in [0, 1].
Expand Down
6 changes: 3 additions & 3 deletions src/diffusers/pipelines/audioldm2/pipeline_audioldm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
>>> from diffusers import AudioLDM2Pipeline

>>> repo_id = "cvssp/audioldm2"
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, dtype=torch.float16)
>>> pipe = pipe.to("cuda")

>>> # define the prompts
Expand Down Expand Up @@ -101,7 +101,7 @@
>>> from diffusers import AudioLDM2Pipeline

>>> repo_id = "anhnct/audioldm2_gigaspeech"
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, dtype=torch.float16)
>>> pipe = pipe.to("cuda")

>>> # define the prompts
Expand Down Expand Up @@ -398,7 +398,7 @@ def encode_prompt(
>>> from diffusers import AudioLDM2Pipeline

>>> repo_id = "cvssp/audioldm2"
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, torch_dtype=torch.float16)
>>> pipe = AudioLDM2Pipeline.from_pretrained(repo_id, dtype=torch.float16)
>>> pipe = pipe.to("cuda")

>>> # Get text embedding vectors
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/aura_flow/pipeline_aura_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>>> import torch
>>> from diffusers import AuraFlowPipeline

>>> pipe = AuraFlowPipeline.from_pretrained("fal/AuraFlow", torch_dtype=torch.float16)
>>> pipe = AuraFlowPipeline.from_pretrained("fal/AuraFlow", dtype=torch.float16)
>>> pipe = pipe.to("cuda")
>>> prompt = "A cat holding a sign that says hello world"
>>> image = pipe(prompt).images[0]
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/auto_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ def from_pretrained(cls, pretrained_model_or_path, **kwargs):
>>> from diffusers import AutoPipelineForText2Audio

>>> pipeline = AutoPipelineForText2Audio.from_pretrained(
... "stabilityai/stable-audio-open-1.0", torch_dtype=torch.float16
... "stabilityai/stable-audio-open-1.0", dtype=torch.float16
... )
>>> pipeline = pipeline.to("cuda")

Expand Down Expand Up @@ -1443,7 +1443,7 @@ def from_pipe(cls, pipeline, **kwargs):
>>> import soundfile as sf
>>> from diffusers import AutoPipelineForText2Audio, StableAudioPipeline

>>> pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", torch_dtype=torch.float16)
>>> pipe = StableAudioPipeline.from_pretrained("stabilityai/stable-audio-open-1.0", dtype=torch.float16)

>>> pipe_audio = AutoPipelineForText2Audio.from_pipe(pipe)
>>> output = pipe_audio(
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/bria/pipeline_bria.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
>>> import torch
>>> from diffusers import BriaPipeline

>>> pipe = BriaPipeline.from_pretrained("briaai/BRIA-3.2", torch_dtype=torch.bfloat16)
>>> pipe = BriaPipeline.from_pretrained("briaai/BRIA-3.2", dtype=torch.bfloat16)
>>> pipe.to("cuda")
# BRIA's T5 text encoder is sensitive to precision. We need to cast it to bfloat16 and keep the final layer in float32.

Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/bria_fibo/pipeline_bria_fibo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
pipe = BriaFiboPipeline.from_pretrained(
"briaai/FIBO",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
dtype=torch.bfloat16,
)
pipe.enable_model_cpu_offload()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

pipe = BriaFiboEditPipeline.from_pretrained(
"briaai/fibo-edit",
torch_dtype=torch.bfloat16,
dtype=torch.bfloat16,
)
pipe.to("cuda")

Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/chroma/pipeline_chroma.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@

>>> model_id = "lodestones/Chroma1-HD"
>>> ckpt_path = "https://huggingface.co/lodestones/Chroma1-HD/blob/main/Chroma1-HD.safetensors"
>>> transformer = ChromaTransformer2DModel.from_single_file(ckpt_path, torch_dtype=torch.bfloat16)
>>> transformer = ChromaTransformer2DModel.from_single_file(ckpt_path, dtype=torch.bfloat16)
>>> pipe = ChromaPipeline.from_pretrained(
... model_id,
... transformer=transformer,
... torch_dtype=torch.bfloat16,
... dtype=torch.bfloat16,
... )
>>> pipe.enable_model_cpu_offload()
>>> prompt = [
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/chroma/pipeline_chroma_img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
>>> pipe = ChromaImg2ImgPipeline.from_pretrained(
... model_id,
... transformer=transformer,
... torch_dtype=torch.bfloat16,
... dtype=torch.bfloat16,
... )
>>> pipe.enable_model_cpu_offload()
>>> init_image = load_image(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
>>> from diffusers import ChromaInpaintPipeline
>>> from diffusers.utils import load_image

>>> pipe = ChromaInpaintPipeline.from_pretrained("lodestones/Chroma1-HD", torch_dtype=torch.bfloat16)
>>> pipe = ChromaInpaintPipeline.from_pretrained("lodestones/Chroma1-HD", dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "Face of a yellow cat, high resolution, sitting on a park bench"
>>> img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
Expand Down
8 changes: 4 additions & 4 deletions src/diffusers/pipelines/chronoedit/pipeline_chronoedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@
>>> # Available models: nvidia/ChronoEdit-14B-Diffusers
>>> model_id = "nvidia/ChronoEdit-14B-Diffusers"
>>> image_encoder = CLIPVisionModel.from_pretrained(
... model_id, subfolder="image_encoder", torch_dtype=torch.float32
... model_id, subfolder="image_encoder", dtype=torch.float32
... )
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", torch_dtype=torch.float32)
>>> vae = AutoencoderKLWan.from_pretrained(model_id, subfolder="vae", dtype=torch.float32)
>>> transformer = ChronoEditTransformer3DModel.from_pretrained(
... model_id, subfolder="transformer", torch_dtype=torch.bfloat16
... model_id, subfolder="transformer", dtype=torch.bfloat16
... )
>>> pipe = ChronoEditPipeline.from_pretrained(
... model_id, vae=vae, image_encoder=image_encoder, transformer=transformer, torch_dtype=torch.bfloat16
... model_id, vae=vae, image_encoder=image_encoder, transformer=transformer, dtype=torch.bfloat16
... )
>>> pipe.to("cuda")

Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/cogvideo/pipeline_cogvideox.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
>>> from diffusers.utils import export_to_video

>>> # Models: "THUDM/CogVideoX-2b" or "THUDM/CogVideoX-5b"
>>> pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-2b", torch_dtype=torch.float16).to("cuda")
>>> pipe = CogVideoXPipeline.from_pretrained("THUDM/CogVideoX-2b", dtype=torch.float16).to("cuda")
>>> prompt = (
... "A panda, dressed in a small, red jacket and a tiny hat, sits on a wooden stool in a serene bamboo forest. "
... "The panda's fluffy paws strum a miniature acoustic guitar, producing soft, melodic tunes. Nearby, a few other "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>>> from diffusers.utils import export_to_video, load_video

>>> pipe = CogVideoXFunControlPipeline.from_pretrained(
... "alibaba-pai/CogVideoX-Fun-V1.1-5b-Pose", torch_dtype=torch.bfloat16
... "alibaba-pai/CogVideoX-Fun-V1.1-5b-Pose", dtype=torch.bfloat16
... )
>>> pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
>>> pipe.to("cuda")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>>> from diffusers import CogVideoXImageToVideoPipeline
>>> from diffusers.utils import export_to_video, load_image

>>> pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V", torch_dtype=torch.bfloat16)
>>> pipe = CogVideoXImageToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V", dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> prompt = "An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
>>> from diffusers.utils import export_to_video, load_video

>>> # Models: "THUDM/CogVideoX-2b" or "THUDM/CogVideoX-5b"
>>> pipe = CogVideoXVideoToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b", torch_dtype=torch.bfloat16)
>>> pipe = CogVideoXVideoToVideoPipeline.from_pretrained("THUDM/CogVideoX-5b", dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> pipe.scheduler = CogVideoXDPMScheduler.from_config(pipe.scheduler.config)

Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/cogview3/pipeline_cogview3plus.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
>>> import torch
>>> from diffusers import CogView3PlusPipeline

>>> pipe = CogView3PlusPipeline.from_pretrained("THUDM/CogView3-Plus-3B", torch_dtype=torch.bfloat16)
>>> pipe = CogView3PlusPipeline.from_pretrained("THUDM/CogView3-Plus-3B", dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> prompt = "A photo of an astronaut riding a horse on mars"
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/cogview4/pipeline_cogview4.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
>>> import torch
>>> from diffusers import CogView4Pipeline

>>> pipe = CogView4Pipeline.from_pretrained("THUDM/CogView4-6B", torch_dtype=torch.bfloat16)
>>> pipe = CogView4Pipeline.from_pretrained("THUDM/CogView4-6B", dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> prompt = "A photo of an astronaut riding a horse on mars"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
>>> import torch
>>> from diffusers import CogView4ControlPipeline

>>> pipe = CogView4ControlPipeline.from_pretrained("THUDM/CogView4-6B-Control", torch_dtype=torch.bfloat16)
>>> pipe = CogView4ControlPipeline.from_pretrained("THUDM/CogView4-6B-Control", dtype=torch.bfloat16)
>>> control_image = load_image(
... "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd_controlnet/bird_canny.png"
... )
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/consisid/pipeline_consisid.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
... eva_transform_mean,
... eva_transform_std,
... ) = prepare_face_models("BestWishYsh/ConsisID-preview", device="cuda", dtype=torch.bfloat16)
>>> pipe = ConsisIDPipeline.from_pretrained("BestWishYsh/ConsisID-preview", torch_dtype=torch.bfloat16)
>>> pipe = ConsisIDPipeline.from_pretrained("BestWishYsh/ConsisID-preview", dtype=torch.bfloat16)
>>> pipe.to("cuda")

>>> # ConsisID works well with long and well-described prompts. Make sure the face in the image is clearly visible (e.g., preferably half-body or full-body).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
>>> device = "cuda"
>>> # Load the cd_imagenet64_l2 checkpoint.
>>> model_id_or_path = "openai/diffusers-cd_imagenet64_l2"
>>> pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, torch_dtype=torch.float16)
>>> pipe = ConsistencyModelPipeline.from_pretrained(model_id_or_path, dtype=torch.float16)
>>> pipe.to(device)

>>> # Onestep Sampling
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/controlnet/pipeline_controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
>>> canny_image = Image.fromarray(image)

>>> # load control net and stable diffusion v1-5
>>> controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
>>> controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", dtype=torch.float16)
>>> pipe = StableDiffusionControlNetPipeline.from_pretrained(
... "stable-diffusion-v1-5/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
... "stable-diffusion-v1-5/stable-diffusion-v1-5", controlnet=controlnet, dtype=torch.float16
... )

>>> # speed up diffusion process with faster scheduler and memory optimization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
>>> import torch

>>> blip_diffusion_pipe = BlipDiffusionControlNetPipeline.from_pretrained(
... "Salesforce/blipdiffusion-controlnet", torch_dtype=torch.float16
... "Salesforce/blipdiffusion-controlnet", dtype=torch.float16
... ).to("cuda")

>>> style_subject = "flower"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
>>> canny_image = Image.fromarray(np_image)

>>> # load control net and stable diffusion v1-5
>>> controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
>>> controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", dtype=torch.float16)
>>> pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
... "stable-diffusion-v1-5/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
... "stable-diffusion-v1-5/stable-diffusion-v1-5", controlnet=controlnet, dtype=torch.float16
... )

>>> # speed up diffusion process with faster scheduler and memory optimization
Expand Down
Loading
Loading