Need your expert input
Hi Team,
Recently, I've been developing one solution, where I'm using - "stabilityai/stable-diffusion-3.5-large" model.
However, I'm facing some issues even after installing the library correctly.
Let's understand the key code -
from diffusers import (
StableDiffusionImg2ImgPipeline,
DPMSolverMultistepScheduler,
)
from huggingface_hub import login
And, the function -
def __init__(self, model_id="stabilityai/stable-diffusion-3.5-large"):
# Check if MPS (Apple Silicon GPU) is available
if not torch.backends.mps.is_available():
raise RuntimeError("MPS (Metal Performance Shaders) is not available on this system.")
# Set device and initialize pipeline
self.device = torch.device("mps")
print("Loading Stable Diffusion pipeline...")
self.pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
model_id,
torch_dtype=torch.float16,
safety_checker=None, # Optional for safety concerns
).to(self.device)
self.pipe.scheduler = DPMSolverMultistepScheduler.from_config(self.pipe.scheduler.config)
self.pipe.enable_attention_slicing()
# Default image dimensions for SD 3.5-large
self.default_height = 768
self.default_width = 768
print("Pipeline successfully loaded.")
However, I'm facing the following error -
Loading Stable Diffusion pipeline...
Loading pipeline components...: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 4/4 [00:00<00:00, 26.49it/s]
Traceback (most recent call last):
File "image_1.py", line 185, in
animator = StableDiffusionAnimator()
File "image_1.py", line 81, in init
self.pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
model_id,
^^^^^^^^^
torch_dtype=torch.float16,
^^^^^^^^^^^^^^^^^^^^^^^^^^
safety_checker=None, # Optional for safety concerns
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
).to(self.device)
^
File "/env/lib/python3.13/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
File "/env/lib/python3.13/site-packages/diffusers/pipelines/pipeline_utils.py", line 943, in from_pretrained
raise ValueError(
f"Pipeline {pipeline_class} expected {expected_modules}, but only {passed_modules} were passed."
)
ValueError: Pipeline <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img.StableDiffusionImg2ImgPipeline'> expected {'image_encoder', 'tokenizer', 'scheduler', 'text_encoder', 'safety_checker', 'feature_extractor', 'unet', 'vae'}, but only {'tokenizer', 'scheduler', 'text_encoder', 'safety_checker', 'vae'} were passed.
Hence, I need your expert input.
Regards.