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

ImportError: cannot import name 'EncoderDecoderCache' from 'transformers' #126

Open
yyf1986 opened this issue Mar 7, 2025 · 0 comments
Open

Comments

@yyf1986
Copy link

yyf1986 commented Mar 7, 2025

python gradio_app.py

Traceback (most recent call last):
  File "/data/yaoyf/Omost/gradio_app.py", line 57, in <module>
    pipeline = StableDiffusionXLOmostPipeline(
  File "/data/yaoyf/Omost/lib_omost/pipeline.py", line 178, in __init__
    super().__init__(*args, **kwargs)
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/diffusers/pipelines/stable_diffusion_xl/pipeline_stable_diffusion_xl_img2img.py", line 274, in __init__
    self.register_modules(
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/diffusers/pipelines/pipeline_utils.py", line 159, in register_modules
    library, class_name = _fetch_class_library_tuple(module)
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 732, in _fetch_class_library_tuple
    not_compiled_module = _unwrap_model(module)
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/diffusers/pipelines/pipeline_loading_utils.py", line 236, in _unwrap_model
    from peft import PeftModel
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/peft/__init__.py", line 22, in <module>
    from .auto import (
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/peft/auto.py", line 32, in <module>
    from .mapping import MODEL_TYPE_TO_PEFT_MODEL_MAPPING
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/peft/mapping.py", line 25, in <module>
    from .mixed_model import PeftMixedModel
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/peft/mixed_model.py", line 29, in <module>
    from .peft_model import PeftModel
  File "/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/peft/peft_model.py", line 37, in <module>
    from transformers import Cache, DynamicCache, EncoderDecoderCache, PreTrainedModel
ImportError: cannot import name 'EncoderDecoderCache' from 'transformers' (/data/yaoyf/Omost/venv_omost/lib/python3.10/site-packages/transformers/__init__.py)

如果降低了transformers的版本,会出现另外一个错误。

ModuleNotFoundError: No module named 'transformers.models.phi3'

经过测试transformers==4.43.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant