完全复现ChatGLM3-6b在阿里云人工智能平台PAI的微调 #828
Closed
KevinFanng
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
我在阿里云里试用人工智能平台PAI/交互式建模(DSW)完成了ChatGLM3-6b的微调,详细过程见https://zhuanlan.zhihu.com/p/681326841
极简过程如下,供大家参考。
1、下载模型
ChatGLM3-6b模型下载(阿里云不支持huggingface,可以到modelscope下载,速度也较快,把模型放在ChatGLM3目录下)
git lfs install
git clone https://www.modelscope.cn/ZhipuAI/chatglm3-6b.git
cd chatglm3-6b/
pwd
/mnt/workspace/ChatGLM3/chatglm3-6b
2、运行basic_demo
(chatglm3-6b) root@dsw-318522-5db699b44f-gxdkk:/mnt/workspace/ChatGLM3/basic_demo# history
1 conda create -n chatglm3-6b python=3.10
2 conda activate chatglm3-6b
3 ll
4 git clone https://github.com/THUDM/ChatGLM3
5 cd ChatGLM3/
6 ll
7 python -m pip install --upgrade pip
8 pip install -r requirements.txt
9 pip install -U transformers
10 cd basic_demo/
11 ll
12 vi cli_demo.py
13 python -V
14 python cli_demo.py
15 history
3、微调
(ChatGLM3-6b-finetunning) root@dsw-318522-5db699b44f-gxdkk:/mnt/workspace/ChatGLM3/finetune_demo# history
1 conda create -n ChatGLM3-6b-finetunning python=3.10
2 conda activate ChatGLM3-6b-finetunning
3 cd finetune_demo
4 ll
5 pip install -r requirements.txt
6 python finetune_hf.py data/fix/ /mnt/workspace/chatglm3-6b/ configs/lora.yaml
7 pip install typer
8 python finetune_hf.py data/fix/ /mnt/workspace/chatglm3-6b/ configs/lora.yaml
9 pip install nltk
10 python finetune_hf.py data/fix/ /mnt/workspace/chatglm3-6b/ configs/lora.yaml
11 pip install sentencepiece
12 pip install -U transformers
13 python finetune_hf.py data/fix/ /mnt/workspace/chatglm3-6b/ configs/lora.yaml
4、推理
python inference_hf.py output/checkpoint-3000/ --prompt "你的提问"
Beta Was this translation helpful? Give feedback.
All reactions