What version of transformers do I need?

#4
by norton-chris - opened

Hi,
I'm getting this error when running the script on the model card:

Traceback (most recent call last):
  File "txt2image.py", line 1, in <module>
    from diffusers import StableDiffusionPipeline
  File "/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/diffusers/__init__.py", line 27, in <module>
    from .pipelines import OnnxRuntimeModel
  File "/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/__init__.py", line 18, in <module>
    from .dance_diffusion import DanceDiffusionPipeline
  File "/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/dance_diffusion/__init__.py", line 1, in <module>
    from .pipeline_dance_diffusion import DanceDiffusionPipeline
  File "/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/dance_diffusion/pipeline_dance_diffusion.py", line 21, in <module>
    from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
  File "/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 64, in <module>
    from transformers.utils import SAFE_WEIGHTS_NAME as TRANSFORMERS_SAFE_WEIGHTS_NAME
ImportError: cannot import name 'SAFE_WEIGHTS_NAME' from 'transformers.utils' (/home/xx/anaconda3/envs/ldm/lib/python3.8/site-packages/transformers/utils/__init__.py)

here's the script:

from diffusers import StableDiffusionPipeline
import torch

model_id = "emilianJR/epiCRealism"
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipe = pipe.to("cuda")

prompt = "PROMPT"
image = pipe(prompt).images[0]

image.save("image.png")

What version of transformers do I need?

I am using the last version, and it works fine. I guess, you have some issues in your environment (maybe anaconda works invalid). Try to run with different OS or in colab. If it doesn't work in colab, contact me, I will try to resolve the problem.

I got it working, setting up a docker and having everything up to date fixed the issue. Also, setup on Colab worked without any issues. Thanks!

norton-chris changed discussion status to closed

Sign up or log in to comment