Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getattr() attribute name must be a string #14

Open
Lalats12 opened this issue Dec 12, 2022 · 3 comments
Open

getattr() attribute name must be a string #14

Lalats12 opened this issue Dec 12, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@Lalats12
Copy link

Lalats12 commented Dec 12, 2022

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
@Lalats12 Lalats12 added the bug Something isn't working label Dec 12, 2022
@Lalats12
Copy link
Author

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
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", scheduler=lms, use_auth_token=True)
File "C:\Users\jpyea\Desktop\For fun\Stable DIffusion\diffusers\src\diffusers\pipeline_utils.py", line 241, in from_pretrained
load_method = getattr(class_obj, load_method_name)
TypeError: getattr(): attribute name must be string

@redwolf2
Copy link

redwolf2 commented Dec 12, 2022

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

@anomaliesintent112
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants