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和推理Error】能打开可视化页面,但是推理图片时报 error 的一种可能的解决方法 #114

Open
zyl-lyz opened this issue Dec 10, 2024 · 1 comment

Comments

@zyl-lyz
Copy link

zyl-lyz commented Dec 10, 2024

部署时一共遇到了三个问题,
问题 1: ImportError: cannot import name 'cached_download' from 'huggingface_hub'
原因requirements.txt 中要求安装 diffusers==0.27.2,但 diffusers 的依赖项 huggingface-hub 未指定版本。
未指定版本,则 pip 默认会安装符合要求的最新版本(我此时是0.26.x),但是 huggingface-hub 从 v0.26.0 版本开始就移除了 cached_download() 方法
( 在 huggingface-hub v0.26.0 的 Release Notes (https://github.com/huggingface/huggingface_hub/releases/tag/v0.26.0) 里可以查到:
Breaking changes
A few breaking changes have been introduced:
cached_download(), url_to_filename(), filename_to_url() methods are now completely removed.From now on, you will have to use hf_hub_download() to benefit from the new cache layout. )
解决方案: 降低 huggingface-hub 的版本,例如降级到 v0.25.0:
pip install huggingface-hub==0.25.0

问题 2: ImportError: cannot import name 'EncoderDecoderCache' from 'transformers'
原因requirements.txt 中指定了 transformers 的版本,但未限制 peft 的版本。
这导致 pip 自动安装了较新版本的 peft(我此时是 v0.14.0),而旧版本的 transformers 与新版本的 peft 可能不兼容。
解决方案:降低 peft 的版本,降到0.13.0:
pip install peft==0.13.0

问题 3: 运行 gradio_demo.py,可以正常打开可视化页面,但是推理图片时报 error
image

具体原因不清楚,但是改了一下包的版本后解决了.....
解决方案:把 gradio 的版本升到3.48.0
pip install gradio==3.48.0

@YuqiaoBai
Copy link

升了gradio还是报error

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

2 participants