前言
Llama3模型在4月18日公布后,国内开发者对Llama3模型进行了很多训练和适配,除了中文纯文本模型外,多模态版本也陆续在发布中。考虑到国内用户对Agent场景的需求,魔搭社区LLM&AIGC模型微调推理框架SWIFT基于Llama3-8b-instruct原始版本训练了通用中文模型,并保留且适配了中文Agent能力,这是开源社区中率先完整适配中文环境的通用Agent Llama3模型,后续会有更完整的评测报告产出。
使用方式
推荐用户直接使用swift进行推理或部署:
# 安装依赖
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
下面介绍如何使用SWIFT框架训练Llama3中文Agent模型
环境准备
我们使用了魔搭官方框架SWIFT进行模型训练:https://github.com/modelscope/swift/tree/main,开发者如果希望训练Llama3中文版本可以参考下面的安装方式:
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 安装ms-swift
git clone https://github.com/modelscope/swift.git
cd swift
pip install -e '.[llm]'
# 环境对齐 (通常不需要运行. 如果你运行错误, 可以跑下面的代码, 仓库使用最新环境测试)
pip install -r requ