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

[BUG] moss模型无法加载 #356

Closed
KyonCN opened this issue May 13, 2023 · 5 comments
Closed

[BUG] moss模型无法加载 #356

KyonCN opened this issue May 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@KyonCN
Copy link

KyonCN commented May 13, 2023

问题描述 / Problem Description
moss模型无法加载,无论是预先下载本地还是直接运行docker下载。

复现问题的步骤 / Steps to Reproduce
docker start chatglm

环境信息 / Environment Information

  • langchain-ChatGLM 版本/commit 号:3ff885d0d38d6645f55e060504d45dce0c7aca26
  • 是否使用 Docker 部署(是/否):是
  • 使用的模型(ChatGLM-6B / ClueAI/ChatYuan-large-v2 等): Moss
  • 使用的 Embedding 模型(GanymedeNil/text2vec-large-chinese 等):GanymedeNil/text2vec-large-chinese
  • 操作系统及版本 / Operating system and version:
  • Python 版本 / Python version:
  • 其他相关环境信息 / Other relevant environment information:

附加信息 / Additional Information
loading model config
llm device: cuda
embedding device: cuda
dir: /chatGLM
flagging username: b6fd7b827501441daa1e3488edd2b7a4

Downloading (…)okenizer_config.json: 100%|██████████| 844/844 [00:00<00:00, 63.4kB/s]
Explicitly passing a revision is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading (…)tokenization_moss.py: 100%|██████████| 14.8k/14.8k [00:00<00:00, 1.35MB/s]
Downloading (…)olve/main/vocab.json: 100%|██████████| 2.50M/2.50M [00:02<00:00, 1.25MDownloading (…)olve/main/vocab.json: 100%|██████████| 2.50M/2.50M [00:02<00:00, 1.25MB/s]
Downloading (…)olve/main/merges.txt: 100%|██████████| 1.34M/1.34M [00:01<00:00, 1.11MDownloading (…)olve/main/merges.txt: 100%|██████████| 1.34M/1.34M [00:01<00:00, 1.10MB/s]
Downloading (…)in/added_tokens.json: 100%|██████████| 1.21k/1.21k [00:00<00:00, 393kB/s]
Downloading (…)cial_tokens_map.json: 100%|██████████| 931/931 [00:00<00:00, 185kB/s]
Downloading (…)lve/main/config.json: 100%|██████████| 1.18k/1.18k [00:00<00:00, 157kB/s]
Explicitly passing a revision is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.
Downloading (…)onfiguration_moss.py: 100%|██████████| 4.99k/4.99k [00:00<00:00, 1.55MB/s]
ERROR 2023-05-13 20:12:24,149-1d: get_class_from_dynamic_module() missing 2 required positional arguments: 'module_file' and 'class_name'
INFO 2023-05-13 20:12:24,149-1d: 模型未成功加载,请到页面左上角"模型配置"选项卡中重新选择后点击"加载模型"按钮
Running on local URL: http://0.0.0.0:7860

@KyonCN KyonCN added the bug Something isn't working label May 13, 2023
@JovenChu
Copy link

JovenChu commented May 17, 2023

@KyonCN 你好,我在2张V100s-32G的环境下,通过修改以下代码可以解决上面的get_class_from_dynamic_module() missing 2 required positional arguments: 'module_file' and 'class_name'问题,供参考:
修改【langchain-ChatGLM/models/moss_llm.py】文件第33行:

def auto_configure_device_map() -> Dict[str, int]: cls = get_class_from_dynamic_module(class_reference="fnlp/moss-moon-003-sft--modeling_moss.MossForCausalLM", pretrained_model_name_or_path=llm_model_dict['moss'])

def auto_configure_device_map() -> Dict[str, int]: cls = get_class_from_dynamic_module(pretrained_model_name_or_path="fnlp/moss-moon-003-sft", module_file="modeling_moss.py", class_name="MossForCausalLM")

且保证moss的模型文件放置在【angchain-ChatGLM/fnlp/moss-moon-003-sft】路径下,可以成功加载模型:
image

@baolixiong
Copy link

@JovenChu 你好,按照你的方法修改后,出现了如下问题,请问该怎么修改
image

@imClumsyPanda
Copy link
Collaborator

pr中有人提出可以将transformers版本提升至4.29.1,大家可以测试看看,我这暂时没有测试环境。

@zyywansui123
Copy link

image

@baolixiong
Copy link

我这个错误是因为显存爆了,我把显存释放,然后就切换成功了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants