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

visualGLM-6B本地部署时,出现deepspeed库循环导入问题的报错!求解答!!!急!!! #377

Open
Zhangluyang6387 opened this issue Mar 10, 2025 · 0 comments

Comments

@Zhangluyang6387
Copy link

运行的代码如下:
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("/home/slm/ZLYproject/Multimodal_LLM/visualglm-6b", trust_remote_code=True)
model = AutoModel.from_pretrained("/home/slm/ZLYproject/Multimodal_LLM/visualglm-6b", trust_remote_code=True).half().cuda()
image_path = "/home/slm/ZLYproject/Multimodal_LLM/1.jpg"
response, history = model.chat(tokenizer, image_path, "描述这张图片。", history=[])
print(response)
response, history = model.chat(tokenizer, image_path, "这张图片可能是在什么场所拍摄的?", history=history)
print(response)

出现错误:ImportError: cannot import name 'DeepSpeedTransformerInference' from partially initialized module 'deepspeed.model_implementations.transformers.ds_transformer' (most likely due to a circular import)
请问这是为什么!!太崩溃了!!!求助!!!

具体报错如下:
Traceback (most recent call last):
File "/home/slm/ZLYproject/Multimodal_LLM/try.py", line 3, in
model = AutoModel.from_pretrained("/home/slm/ZLYproject/Multimodal_LLM/visualglm-6b", trust_remote_code=True).half().cuda()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/transformers/models/auto/auto_factory.py", line 558, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/transformers/modeling_utils.py", line 2954, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/slm/.cache/huggingface/modules/transformers_modules/visualglm-6b/modeling_chatglm.py", line 1344, in init
from .visual import BLIP2
File "/home/slm/.cache/huggingface/modules/transformers_modules/visualglm-6b/visual.py", line 4, in
from sat.model import ViTModel, BaseModel
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/sat/init.py", line 6, in
from .training.deepspeed_training import training_main
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/sat/training/deepspeed_training.py", line 27, in
import deepspeed
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/init.py", line 25, in
from . import ops
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/ops/init.py", line 11, in
from . import transformer
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/ops/transformer/init.py", line 8, in
from ...model_implementations.transformers.ds_transformer import DeepSpeedTransformerInference
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/model_implementations/transformers/ds_transformer.py", line 18, in
from deepspeed.ops.transformer.inference.triton.mlp import TritonMLP
File "/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/ops/transformer/inference/init.py", line 7, in
from ....model_implementations.transformers.ds_transformer import DeepSpeedTransformerInference
ImportError: cannot import name 'DeepSpeedTransformerInference' from partially initialized module 'deepspeed.model_implementations.transformers.ds_transformer' (most likely due to a circular import) (/home/slm/miniconda3/envs/PY311/lib/python3.11/site-packages/deepspeed/model_implementations/transformers/ds_transformer.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

1 participant