Skip to content

Windows下多线程使用mindnlp.transformers的AutoTokenizer会出现循环导入问题 #2240

Description

@ShangJingLi

Describe the bug/ 问题描述 (Mandatory / 必填)
Windows系统上运行项目脚本出现mindtorch循环报错

  • Hardware Environment(Ascend/GPU/CPU) / 硬件环境:
    CPU

  • Software Environment / 软件环境 (Mandatory / 必填):
    -- MindSpore version (e.g., 1.7.0.Bxxx) :2.7.0
    -- Python version (e.g., Python 3.7.5) :3.11.11
    -- OS platform and distribution (e.g., Linux Ubuntu 16.04):Windows11
    -- GCC/Compiler version (if compiled from source):无

  • Excute Mode / 执行模式 (Mandatory / 必填)(PyNative/Graph):

Please delete the mode not involved / 请删除不涉及的模式:
默认方式

To Reproduce / 重现步骤 (Mandatory / 必填)
Steps to reproduce the behavior:
1.项目链接:https://gitee.com/lishangjing2024/chat-law.git
2.报错脚本:ChatLaw/chatlaw/client/client_ms.py
3.复现方式:将import部分的from transformers import AutoTokenizer改为from mindnlp.transformers import AutoTokenizer;将model_inputs = tokenizer([templated], return_tensors="np")改为model_inputs = tokenizer([templated], return_tensors="ms")
4.Windows系统下运行脚本,无需连接服务器,即可复现错误

Expected behavior / 预期结果 (Mandatory / 必填)
能正常出现gradio生成的本地连接即端口即正常

Screenshots/ 日志 / 截图 (Mandatory / 必填)

Image

Additional context / 备注 (Optional / 选填)
Add any other context about the problem here.
Linux系统运行客户端无法复现错误。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions