huggingface / diffusers

🤗 Diffusers: State-of-the-art diffusion models for image and audio generation in PyTorch and FLAX.
https://huggingface.co/docs/diffusers
Apache License 2.0
23.99k stars 4.94k forks source link

`.from_single_file` breaking in v28.2 if model_index.json is empty, unintuitive logs #8474

Open underscore-en opened 3 weeks ago

underscore-en commented 3 weeks ago

Describe the bug

I've been using diffuser for couple months, primarily for StableDiffusionPipeline and StableDiffusionXLPipeline image inference using a downloaded .safetensors A while back I upgraded to v28.2 and .from_single_file complained (refer to logs)

I did some debugging and concluded that for whatever reason my .cache/hf/hub/model-sth-xl-base/snapshot/model_index.json is empty, which caused this error (keys in the json is used to populate sth).

Logs are really not intuitive. For whatever reason this isn't an issue in v27.2.

Reproduction

empty the JSON in .cache/hf/hub/model-sth-xl-base/snapshot/model_index.json

Logs

File ".....\.venv\lib\site-packages\diffusers\loaders\single_file.py", line 529, in from_single_file
    raise ValueError(
ValueError: Pipeline <class 'diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion.StableDiffusionPipeline'> expected {'image_encoder', 'scheduler', 'feature_extractor', 'unet', 'text_encoder', 'tokenizer', 'vae', 'safety_checker'}, but only set() were passed.
(.venv)

System Info

python 3.10 in windows .venv

Who can help?

No response

sayakpaul commented 2 weeks ago

Cc: @DN6

DN6 commented 1 week ago

Hi @underscore-en we refactored from_single_file in version 0.28.0 to rely on the model-index.json to configure the pipeline, which could be what's causing the issue.

Is it possible to host your checkpoint on the HF Hub and share it? Additionally could you share a minimal code example we could use to reproduce the issue?