Skip to content

Bug in convert_original_stable_diffusion_to_diffusers.py #6899

@ehsan

Description

@ehsan

Describe the bug

See the steps to reproduce below.

This is caused by this code change. yaml.safe_load() takes a stream object not a file path name, so currently it just returns the file path, causing the error shown below.

Reproduction

Run this command to convert a checkpoint into diffusers format:

python3 /path/to/diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py   --pipeline_class_name StableDiffusionXLPipeline  --checkpoint_path  /path/to/file.ckpt --original_config_file /path/to/config.yaml --dump_path /path/to/output

It fails like this:

Traceback (most recent call last):
  File "/path/to/diffusers/scripts/convert_original_stable_diffusion_to_diffusers.py", line 160, in <module>
    pipe = download_from_original_stable_diffusion_ckpt(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/diffusers/src/diffusers/pipelines/stable_diffusion/convert_from_ckpt.py", line 1329, in download_from_original_stable_diffusion_ckpt
    and "cond_stage_config" in original_config["model"]["params"]
                               ~~~~~~~~~~~~~~~^^^^^^^^^
TypeError: string indices must be integers, not 'str'

Logs

No response

System Info

python 3.11, diffusers main branch.

Who can help?

cc @sayakpaul FYI

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions