Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
Sign in
Sign up
Fetch the repository succeeded.
Open Source
>
AI/ML
>
Natural Language Processing
&&
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
8
Star
38
Fork
19
MindSpore Lab
/
mindnlp
Code
Issues
14
Pull Requests
3
Wiki
Insights
Pipelines
Service
JavaDoc
PHPDoc
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
0.5.0版本在ms2.6上提示导入错误
Backlog
#ICPWU6
ilovescrapy
Opened this issue
2025-07-30 21:30
环境:  **执行代码:** import mindspore import mindnlp from transformers import pipeline chat = [ {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."}, {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"} ] pipeline = pipeline(task="text-generation", model="Qwen/Qwen3-8B", ms_dtype=mindspore.bfloat16, device_map="auto") response = pipeline(chat, max_new_tokens=512) print(response[0]["generated_text"][-1]["content"])  **完整报错如下:** ImportError Traceback (most recent call last) Cell In[2], line 2 1 import mindspore ----> 2 import mindnlp 3 from transformers import pipeline 5 chat = [ 6 {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."}, 7 {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"} 8 ] File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/__init__.py:50 47 from .core._tensor import enable_mindspore_patch 49 enable_mindspore_patch() ---> 50 initialize_torch_proxy() 51 setup_metadata_patch() 52 setup_safetensors_patch() File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:99, in initialize_torch_proxy() 97 def initialize_torch_proxy(): 98 sys.meta_path.insert(0, RedirectFinder(REDIRECT_MAP)) ---> 99 import torch 100 torch.__version__ = "2.1.1+dev" File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:23, in RedirectFinder.find_spec(self, fullname, path, target) 21 importlib.import_module(target_name) 22 except Exception as e: ---> 23 raise e 25 return importlib.machinery.ModuleSpec( 26 name=fullname, 27 loader=RedirectLoader(target_name), 28 is_package=self._is_package(target_name), 29 ) 30 return None File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:21, in RedirectFinder.find_spec(self, fullname, path, target) 19 target_name = fullname.replace(proxy_prefix, target_prefix, 1) 20 try: ---> 21 importlib.import_module(target_name) 22 except Exception as e: 23 raise e File ~/miniconda/envs/jupyter/lib/python3.9/importlib/__init__.py:127, in import_module(name, package) 125 break 126 level += 1 --> 127 return _bootstrap._gcd_import(name[level:], package, level) File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/__init__.py:50 48 from ._C.size import Size 49 from .types import device ---> 50 from .autograd import * 51 from .ops import * 52 from .serialization import load, save File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/__init__.py:3 1 """autograd""" 2 from .node import Node ----> 3 from .function import Function, value_and_grad 4 from .grad_mode import no_grad, enable_grad, inference_mode File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/function.py:9 7 from mindspore.common.api import _pynative_executor 8 from mindspore._c_expression import Cell_ ----> 9 from .grad_mode import no_grad 11 try: 12 from mindspore import _Function as Function File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/grad_mode.py:17 15 """core module""" 16 from mindspore.common.api import _pynative_executor ---> 17 from ..utils._contextlib import _NoParamDecoratorContextManager, _DecoratorContextManager 19 class no_grad(_NoParamDecoratorContextManager): 20 """ 21 Context Manager to disable gradient calculation. When enter this context, we will disable calculate 22 gradient. When exit this context, we will resume its prev state. 23 Currently, it can only use in Pynative mode. It also can be used as decorator. 24 """ File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/utils/__init__.py:2 1 """utils""" ----> 2 from . import data ImportError: cannot import name 'data' from partially initialized module 'mindnlp.core.utils' (most likely due to a circular import) (/home/mindspore/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/utils/__init__.py)
环境:  **执行代码:** import mindspore import mindnlp from transformers import pipeline chat = [ {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."}, {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"} ] pipeline = pipeline(task="text-generation", model="Qwen/Qwen3-8B", ms_dtype=mindspore.bfloat16, device_map="auto") response = pipeline(chat, max_new_tokens=512) print(response[0]["generated_text"][-1]["content"])  **完整报错如下:** ImportError Traceback (most recent call last) Cell In[2], line 2 1 import mindspore ----> 2 import mindnlp 3 from transformers import pipeline 5 chat = [ 6 {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."}, 7 {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"} 8 ] File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/__init__.py:50 47 from .core._tensor import enable_mindspore_patch 49 enable_mindspore_patch() ---> 50 initialize_torch_proxy() 51 setup_metadata_patch() 52 setup_safetensors_patch() File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:99, in initialize_torch_proxy() 97 def initialize_torch_proxy(): 98 sys.meta_path.insert(0, RedirectFinder(REDIRECT_MAP)) ---> 99 import torch 100 torch.__version__ = "2.1.1+dev" File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:23, in RedirectFinder.find_spec(self, fullname, path, target) 21 importlib.import_module(target_name) 22 except Exception as e: ---> 23 raise e 25 return importlib.machinery.ModuleSpec( 26 name=fullname, 27 loader=RedirectLoader(target_name), 28 is_package=self._is_package(target_name), 29 ) 30 return None File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/utils/torch_proxy.py:21, in RedirectFinder.find_spec(self, fullname, path, target) 19 target_name = fullname.replace(proxy_prefix, target_prefix, 1) 20 try: ---> 21 importlib.import_module(target_name) 22 except Exception as e: 23 raise e File ~/miniconda/envs/jupyter/lib/python3.9/importlib/__init__.py:127, in import_module(name, package) 125 break 126 level += 1 --> 127 return _bootstrap._gcd_import(name[level:], package, level) File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/__init__.py:50 48 from ._C.size import Size 49 from .types import device ---> 50 from .autograd import * 51 from .ops import * 52 from .serialization import load, save File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/__init__.py:3 1 """autograd""" 2 from .node import Node ----> 3 from .function import Function, value_and_grad 4 from .grad_mode import no_grad, enable_grad, inference_mode File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/function.py:9 7 from mindspore.common.api import _pynative_executor 8 from mindspore._c_expression import Cell_ ----> 9 from .grad_mode import no_grad 11 try: 12 from mindspore import _Function as Function File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/autograd/grad_mode.py:17 15 """core module""" 16 from mindspore.common.api import _pynative_executor ---> 17 from ..utils._contextlib import _NoParamDecoratorContextManager, _DecoratorContextManager 19 class no_grad(_NoParamDecoratorContextManager): 20 """ 21 Context Manager to disable gradient calculation. When enter this context, we will disable calculate 22 gradient. When exit this context, we will resume its prev state. 23 Currently, it can only use in Pynative mode. It also can be used as decorator. 24 """ File ~/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/utils/__init__.py:2 1 """utils""" ----> 2 from . import data ImportError: cannot import name 'data' from partially initialized module 'mindnlp.core.utils' (most likely due to a circular import) (/home/mindspore/miniconda/envs/jupyter/lib/python3.9/site-packages/mindnlp/core/utils/__init__.py)
Comments (
0
)
Sign in
to comment
Status
Backlog
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Branches
No related branch
Branches (4)
Tags (14)
master
0.4
janus
revert-1830-master
v0.5.0rc3
v0.5.0rc2
v0.5.0rc1
v0.4.1
v0.4.0
v0.3.1
v0.3.0
v0.2.4
v0.2.3
v0.2.2
v0.2.1
v0.2.0
v0.1.1
v0.0.1-alpha
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
1
https://gitee.com/mindspore-lab/mindnlp.git
git@gitee.com:mindspore-lab/mindnlp.git
mindspore-lab
mindnlp
mindnlp
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register