Downloads · 30 days
24
6% of all-time downloads
modelscope/Llama3-Chinese-8B-Instruct-Agent-v1
Llama3-Chinese-8B-Instruct-Agent-v1 is a text generation model from modelscope. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.
本模型使用Llama3-8b-instruct基模型进行训练,适配中文通用场景,且支持ReACT格式的Agent调用。
Downloads · 30 days
24
6% of all-time downloads
All-time downloads
376
Public
Parameters
8B
30 GB on disk
Likes
7
Public
Click a slice to open those files.
.safetensors30 GB · 100%
How the weights are stored.
F327B · 87%
From the Hugging Face model README
本模型使用Llama3-8b-instruct基模型进行训练,适配中文通用场景,且支持ReACT格式的Agent调用。
# 安装依赖
pip install ms-swift -U
# 推理
swift infer --model_type llama3-8b-instruct --model_id_or_path swift/Llama3-Chinese-8B-Instruct-Agent-v1
# 部署
swift deploy --model_type llama3-8b-instruct --model_id_or_path swift/Llama3-Chinese-8B-Instruct-Agent-v1
本模型可以联合ModelScopeAgent框架使用,请参考:
为了适配中文及Agent场景,我们针对语料进行了一定混合配比,训练Llama3使用的语料如下:
- COIG-CQIA:https://modelscope.cn/datasets/AI-ModelScope/COIG-CQIA/summary 该数据集包含了中国传统知识、豆瓣、弱智吧、知乎等中文互联网信息
- 魔搭通用Agent训练数据集: https://modelscope.cn/datasets/AI-ModelScope/ms-agent-for-agentfabric/summary
- alpaca-en: https://modelscope.cn/datasets/AI-ModelScope/alpaca-gpt4-data-en/summary
- ms-bench魔搭通用中文问答数据集: https://modelscope.cn/datasets/iic/ms_bench/summary
| 超参数 | 值 |
|---|---|
| lr | 5e-5 |
| epoch | 2 |
| lora_rank | 8 |
| lora_alpha | 32 |
| lora_target_modules | ALL |
| batch_size | 2 |
| gradient_accumulation_steps | 16 |
NPROC_PER_NODE=8 \
swift sft \
--model_type llama3-8b-instruct \
--dataset ms-agent-for-agentfabric-default alpaca-en ms-bench ms-agent-for-agentfabric-addition coig-cqia-ruozhiba coig-cqia-zhihu coig-cqia-exam coig-cqia-chinese-traditional coig-cqia-logi-qa coig-cqia-segmentfault coig-cqia-wiki \
--batch_size 2 \
--max_length 2048 \
--use_loss_scale true \
--gradient_accumulation_steps 16 \
--learning_rate 5e-5 \
--use_flash_attn true \
--eval_steps 500 \
--save_steps 500 \
--train_dataset_sample -1 \
--dataset_test_ratio 0.1 \
--val_dataset_sample 10000 \
--num_train_epochs 2 \
--check_dataset_strategy none \
--gradient_checkpointing true \
--weight_decay 0.01 \
--warmup_ratio 0.03 \
--save_total_limit 2 \
--logging_steps 10 \
--sft_type lora \
--lora_target_modules ALL \
--lora_rank 8 \
--lora_alpha 32
| 评测模型 | ARC | CEVAL | GSM8K |
|---|---|---|---|
| Llama3-8b-instruct | 0.7645 | 0.5089 | 0.7475 |
| Llama3-Chinese-8B-Instruct-Agent-v1 | 0.7577 | 0.4903 | 0.652 |
GSM8K英文数学能力下降了8个点左右,经过消融实验我们发现去除alpaca-en语料会导致GSM8K下降至少十个点以上。