modelscope / ms-swift

Use PEFT or Full-parameter to finetune 350+ LLMs or 90+ MLLMs. (Qwen2.5, GLM4v, Internlm2.5, Yi, Llama3.1, Llava-Video, Internvl2, MiniCPM-V-2.6, Deepseek, Baichuan2, Gemma2, Phi3-Vision, ...)
https://swift.readthedocs.io/zh-cn/latest/Instruction/index.html
Apache License 2.0
3.49k stars 299 forks source link

ValueError: `model_id_or_path`: 'share_data/base_llms/Yi-6B-200K' is not registered. #178

Closed Tendo33 closed 9 months ago

Tendo33 commented 9 months ago

我已经把模型权重保存下来了,为什么在推理的时候显示未注册了,我试了model.py里所有的模型,为什么都显示未注册啊

Jintao-Huang commented 9 months ago

您好, 可以参考对模型进行注册 https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.md

你看看是不是--model_type和--model_id_or_path误用了

Tendo33 commented 9 months ago

您好, 可以参考对模型进行注册 https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.md

你看看是不是--model_type和--model_id_or_path误用了

没有误用,我在启动行去除 --model_type 之后:ValueError: `model_id_or_path`: '/share_data/base_llms/Yi-6B-200K' is not registered. Please use `model_cache_dir` to specify the local cache path for the model. 我修改成 model_id_or_path之后:ValueError: please setting `--model_type xxx` or `--model_id_or_path xxx 这两个错误开始踢皮球了

Jintao-Huang commented 9 months ago

--model_id_or_path和--model_cache_dir需要一起指定的

Tendo33 commented 9 months ago

--model_id_or_path和--model_cache_dir需要一起指定的

哦哦哦明白了,感谢

Tendo33 commented 9 months ago

这是我的run 脚本

#!/bin/bash
PYTHONPATH=../../.. \
    CUDA_VISIBLE_DEVICES=1 \
    python llm_sft.py \
    --model_type Yi-6B-200K \
    --model_id_or_path /workspace/share_data/base_llms/Yi-6B-200K \
    --model_cache_dir /workspace/share_data/base_llms/Yi-6B-200K \
    --model_revision master \
    --sft_type lora \
    --tuner_backend swift \
    --template_type chatml \
    --dtype bf16 \
    --output_dir output_gw_chatml \
    --custom_train_dataset_path gw_train_data.jsonl \
    --train_dataset_sample -1 \
    --num_train_epochs 1 \
    --max_length 200000 \
    --check_dataset_strategy warning \
    --lora_rank 8 \
    --lora_alpha 32 \
    --lora_dropout_p 0.05 \
    --lora_target_modules ALL \
    --gradient_checkpointing true \
    --batch_size 1 \
    --weight_decay 0.01 \
    --learning_rate 1e-4 \
    --gradient_accumulation_steps 16 \
    --max_grad_norm 0.5 \
    --warmup_ratio 0.03 \
    --eval_steps 100 \
    --save_steps 100 \
    --save_total_limit 2 \
    --logging_steps 10

报错为:

2023-12-06 08:56:35,566 - modelscope - INFO - PyTorch version 2.1.1 Found.
2023-12-06 08:56:35,566 - modelscope - INFO - Loading ast index from /root/.cache/modelscope/ast_indexer
2023-12-06 08:56:35,593 - modelscope - INFO - Loading done! Current index file version is 1.9.5, with md5 6821166d03175a942a19240fc049d914 and a total number of 945 components indexed
Traceback (most recent call last):
  File "/workspace/sunjinfeng/github_projet/swift/examples/pytorch/llm/llm_sft.py", line 7, in <module>
    output = sft_main()
  File "/workspace/sunjinfeng/github_projet/swift/swift/utils/run_utils.py", line 21, in x_main
    args, remaining_argv = parse_args(args_class, argv)
  File "/workspace/sunjinfeng/github_projet/swift/swift/utils/utils.py", line 66, in parse_args
    args, remaining_args = parser.parse_args_into_dataclasses(
  File "/root/miniconda3/envs/swift/lib/python3.9/site-packages/transformers/hf_argparser.py", line 338, in parse_args_into_dataclasses
    obj = dtype(**inputs)
  File "<string>", line 76, in __init__
  File "/workspace/sunjinfeng/github_projet/swift/swift/llm/utils/argument.py", line 161, in __post_init__
    set_model_type(self)
  File "/workspace/sunjinfeng/github_projet/swift/swift/llm/utils/argument.py", line 485, in set_model_type
    assert args.model_type is None or args.model_id_or_path is None
AssertionError
Jintao-Huang commented 9 months ago

Yi-6B-200K和Yi-34B-200K之前需要自己注册. 现在已经增加: https://github.com/modelscope/swift/pull/207

Tendo33 commented 9 months ago

Yi-6B-200K和Yi-34B-200K之前需要自己注册. 现在已经增加: #207

好的谢谢、

plutoda588 commented 8 months ago

您好, 可以参考对模型进行注册 https://github.com/modelscope/swift/blob/main/docs/source/LLM/%E8%87%AA%E5%AE%9A%E4%B9%89%E4%B8%8E%E6%8B%93%E5%B1%95.md

你看看是不是--model_type和--model_id_or_path误用了 你好,我的命令如下,我cd examples/pytorch/llm到这个文件目录下去执行。 执行命令如下: PYTHONPATH=../../.. \ CUDA_VISIBLE_DEVICES=0,1 \ python llm_sft.py \ --model_id_or_path /T106/LLM_model/Mixtral-8x7B-v0.1 \ --model_revision master \ --sft_type lora \ --tuner_backend swift \ --dtype AUTO \ --output_dir output \ --ddp_backend nccl \ --dataset dureader-robust-zh \ --train_dataset_sample -1 \ --num_train_epochs 2 \ --max_length 512 \ --check_dataset_strategy warning \ --lora_rank 8 \ --lora_alpha 32 \ --lora_dropout_p 0.05 \ --lora_target_modules ALL \ --batch_size 1 \ --weight_decay 0.01 \ --learning_rate 1e-4 \ --gradient_accumulation_steps 16 \ --max_grad_norm 0.5 \ --warmup_ratio 0.03 \ --eval_steps 300 \ --save_steps 300 \ --save_total_limit 2 \ --logging_steps 10 \ --only_save_model true \ --gradient_checkpointing false 我想的是去微调mixtral模型,但是也出现同样的错误;

微信图片_20240105212220

我的环境都配置好了,可以加载mixtral模型,用的两张A800

plutoda588 commented 8 months ago

我已经把模型权重保存下来了,为什么在推理的时候显示未注册了,我试了model.py里所有的模型,为什么都显示未注册啊

你好,你解决了这个问题嘛?我也出现同样的错误。