diffusers
diffusers copied to clipboard
getattr() attribute name must be a string
Describe the bug
When executing the file, save_onnx.py, I encountered this error
Traceback (most recent call last):
File "C:\Users\jpyea\Desktop\For fun\Stable Diffuse\diffusers\examples\inference\save_onnx.py", line 16, in <module>
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", scheduler=lms, use_auth_token=True)
File "C:\Users\jpyea\Desktop\For fun\Stable Diffuse\diffusers\src\diffusers\pipeline_utils.py", line 240, in from_pretrained
load_method = getattr(class_obj, load_method_name)
TypeError: getattr(): attribute name must be string
Reproduction
Logs
No response
System Info
Python 3.10.6
Diffuser version: 1.4
Additional notes
I found this while modifying the code
<class 'diffusers.pipelines.stable_diffusion.safety_checker.StableDiffusionSafetyChecker'>
from_pretrained
<class 'diffusers.models.vae.AutoencoderKL'>
from_pretrained
<class 'transformers.models.clip.modeling_clip.CLIPTextModel'>
from_pretrained
<class 'transformers.models.clip.image_processing_clip.CLIPImageProcessor'>
None
Traceback (most recent call last):
File "C:\Users\jpyea\Desktop\For fun\Stable DIffusion\diffusers\examples\inference\save_onnx.py", line 16, in
This worked for me:
This
getattr()error is caused by the latest update on the transformers package (4.25.1/4.25.0: Dec.2, 2022). To fix it, simply downgrade the transformers package to an earlier version, e.g.,pip install transformers==4.24.0, then everything goes fine.
https://huggingface.co/CompVis/stable-diffusion-v1-4/discussions/158#638eb290e160c226bac9d428
i was having the same problem and when i downgraded i ran into the problem where the module CLIPImageprocessor was missing. The solution is to upgrade transformers to the latest version 4.29.2 and then upgrade diffusers with the command pip install -U diffusers. Im currently running version 0.16.1