Skip to content

StableDiffusionImg2ImgPipeline can't load by onnx revision #746

@LowinLi

Description

@LowinLi

Describe the bug

when load StableDiffusionImg2ImgPipeline through from_pretrained by revision="onnx". an Exception raised:

File ~/venv/lib/python3.8/site-packages/diffusers/pipeline_utils.py:391, in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    388     init_kwargs[name] = loaded_sub_model  # UNet(...), # DiffusionSchedule(...)
    390 # 4. Instantiate the pipeline
--> 391 model = pipeline_class(**init_kwargs)
    392 return model

TypeError: __init__() missing 1 required positional argument: 'vae'

Reproduction

from diffusers import StableDiffusionImg2ImgPipeline

pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", revision="onnx", use_auth_token=token, provider="CPUExecutionProvider"
)

Logs

TypeError                                 Traceback (most recent call last)
Cell In [9], line 9
      6 token = "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"
      7 # load the pipeline
----> 9 pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
     10     "CompVis/stable-diffusion-v1-4", revision="onnx", use_auth_token=token, provider="CPUExecutionProvider", force_download=True
     11 )
     13 # let's download an initial image
     14 url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"

File ~/venv/lib/python3.8/site-packages/diffusers/pipeline_utils.py:391, in DiffusionPipeline.from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
    388     init_kwargs[name] = loaded_sub_model  # UNet(...), # DiffusionSchedule(...)
    390 # 4. Instantiate the pipeline
--> 391 model = pipeline_class(**init_kwargs)
    392 return model

TypeError: __init__() missing 1 required positional argument: 'vae'

System Info

  • diffusers version: 0.3.0
  • Platform: Linux-5.13.0-41-generic-x86_64-with-glibc2.29
  • Python version: 3.8.1
  • PyTorch version (GPU?): 1.10.0+cu102 (True)
  • Huggingface_hub version: 0.9.1
  • Transformers version: 4.22.2
  • Using GPU in script?:
  • Using distributed or parallel set-up in script?:

Metadata

Metadata

Assignees

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