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

运行streamlit run main.py提示ModuleNotFoundError: No module named 'huggingface_hub.inference._text_generation' #1074

Closed
1 of 2 tasks
zhaoqi9 opened this issue Apr 1, 2024 · 5 comments
Assignees

Comments

@zhaoqi9
Copy link

zhaoqi9 commented Apr 1, 2024

System Info / 系統信息

创建的conda环境完全按照requirements.txt安装环境,查看huggingface-hub为0.22.2,提示如题目的报错信息,于是调整为:
huggingface_hub==0.19.4,顺利运行。

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

创建的conda环境完全按照requirements.txt安装环境,查看huggingface-hub为0.22.2,提示如题目的报错信息,于是调整为:
huggingface_hub==0.19.4,顺利运行。

Expected behavior / 期待表现

能否不对huggingface版本有依赖,尤其是降级版本。

@zRzRzRzRzRzRzR zRzRzRzRzRzRzR self-assigned this Apr 1, 2024
@zRzRzRzRzRzRzR
Copy link
Member

huggingface_hub根模型推理应该没关系吧

@zhaoqi9
Copy link
Author

zhaoqi9 commented Apr 1, 2024

huggingface_hub根模型推理应该没关系吧

我看到huggingface_hub==0.19.4的名称是huggingface_hub,而huggingface-hub==0.22.2的名称是huggingface-hub,看来软件包有一定的变化,如果版本高,确实提示如此,降级到requirements.txt的最低要求,就可以了。

@nqxytttt
Copy link

nqxytttt commented Apr 1, 2024

huggingface_hub根模型推理应该没关系吧

我也遇到了这个问题,huggingface_hub降到0.19.4可以解决这个问题,可以看到0.22.2版本没有_text_generation这个文件
https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub/inference
微信图片_20240402003202

@wyfSunflower
Copy link

python3.12

  • install huggingface_hub-0.19.4-py3-none-any.whl
    `` streamlit run ./composite_demo/main.py

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.

2024-07-10 10:04:38.539 Did not auto detect external IP.
Please go to https://docs.streamlit.io/ for debugging hints.

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501
Network URL: http://127.0.0.1:8501

2024-07-10 10:04:58.096 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
exec(code, module.dict)
File "/home/ChatGLM3/composite_demo/main.py", line 10, in
import demo_chat, demo_ci, demo_tool
File "/home/ChatGLM3/composite_demo/demo_chat.py", line 4, in
from client import get_client
File "/home/ChatGLM3/composite_demo/client.py", line 10, in
from transformers import AutoModel, AutoTokenizer, AutoConfig
File "/usr/local/lib/python3.12/site-packages/transformers/init.py", line 26, in
from . import dependency_versions_check
File "/usr/local/lib/python3.12/site-packages/transformers/dependency_versions_check.py", line 16, in
from .utils.versions import require_version, require_version_core
File "/usr/local/lib/python3.12/site-packages/transformers/utils/init.py", line 68, in
from .hub import (
File "/usr/local/lib/python3.12/site-packages/transformers/utils/hub.py", line 49, in
from huggingface_hub.utils import (
ImportError: cannot import name 'OfflineModeIsEnabled' from 'huggingface_hub.utils' (/usr/local/lib/python3.12/site-packages/huggingface_hub/utils/init.py)
2024-07-10 10:04:58.779 Uncaught app exception
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script
exec(code, module.dict)
File "/home/ChatGLM3/composite_demo/main.py", line 10, in
import demo_chat, demo_ci, demo_tool
File "/home/ChatGLM3/composite_demo/demo_chat.py", line 4, in
from client import get_client
File "/home/ChatGLM3/composite_demo/client.py", line 10, in
from transformers import AutoModel, AutoTokenizer, AutoConfig
File "/usr/local/lib/python3.12/site-packages/transformers/init.py", line 26, in
from . import dependency_versions_check
File "/usr/local/lib/python3.12/site-packages/transformers/dependency_versions_check.py", line 16, in
from .utils.versions import require_version, require_version_core
File "/usr/local/lib/python3.12/site-packages/transformers/utils/init.py", line 68, in
from .hub import (
File "/usr/local/lib/python3.12/site-packages/transformers/utils/hub.py", line 49, in
from huggingface_hub.utils import (
ImportError: cannot import name 'OfflineModeIsEnabled' from 'huggingface_hub.utils' (/usr/local/lib/python3.12/site-packages/huggingface_hub/utils/init.py)``

@zzlTim
Copy link

zzlTim commented Jul 26, 2024

python3.12

  • install huggingface_hub-0.19.4-py3-none-any.whl
    `` streamlit run ./composite_demo/main.py

Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.

2024-07-10 10:04:38.539 Did not auto detect external IP. Please go to https://docs.streamlit.io/ for debugging hints.

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501 Network URL: http://127.0.0.1:8501

2024-07-10 10:04:58.096 Uncaught app exception Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script exec(code, module.dict) File "/home/ChatGLM3/composite_demo/main.py", line 10, in import demo_chat, demo_ci, demo_tool File "/home/ChatGLM3/composite_demo/demo_chat.py", line 4, in from client import get_client File "/home/ChatGLM3/composite_demo/client.py", line 10, in from transformers import AutoModel, AutoTokenizer, AutoConfig File "/usr/local/lib/python3.12/site-packages/transformers/init.py", line 26, in from . import dependency_versions_check File "/usr/local/lib/python3.12/site-packages/transformers/dependency_versions_check.py", line 16, in from .utils.versions import require_version, require_version_core File "/usr/local/lib/python3.12/site-packages/transformers/utils/init.py", line 68, in from .hub import ( File "/usr/local/lib/python3.12/site-packages/transformers/utils/hub.py", line 49, in from huggingface_hub.utils import ( ImportError: cannot import name 'OfflineModeIsEnabled' from 'huggingface_hub.utils' (/usr/local/lib/python3.12/site-packages/huggingface_hub/utils/init.py) 2024-07-10 10:04:58.779 Uncaught app exception Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 589, in _run_script exec(code, module.dict) File "/home/ChatGLM3/composite_demo/main.py", line 10, in import demo_chat, demo_ci, demo_tool File "/home/ChatGLM3/composite_demo/demo_chat.py", line 4, in from client import get_client File "/home/ChatGLM3/composite_demo/client.py", line 10, in from transformers import AutoModel, AutoTokenizer, AutoConfig File "/usr/local/lib/python3.12/site-packages/transformers/init.py", line 26, in from . import dependency_versions_check File "/usr/local/lib/python3.12/site-packages/transformers/dependency_versions_check.py", line 16, in from .utils.versions import require_version, require_version_core File "/usr/local/lib/python3.12/site-packages/transformers/utils/init.py", line 68, in from .hub import ( File "/usr/local/lib/python3.12/site-packages/transformers/utils/hub.py", line 49, in from huggingface_hub.utils import ( ImportError: cannot import name 'OfflineModeIsEnabled' from 'huggingface_hub.utils' (/usr/local/lib/python3.12/site-packages/huggingface_hub/utils/init.py)``

你解决了吗

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

5 participants