forked from jiuyuan/CPM-9G-8B
Compare commits
No commits in common. "FM_9G" and "FM_9G" have entirely different histories.
41
README.md
41
README.md
|
@ -1,27 +1,24 @@
|
|||
夸克网盘 docker链接:https://pan.quark.cn/s/4cda395f13e8
|
||||
(没有会员请联系我下载)
|
||||
方案:
|
||||
全参数微调,使用不同数据集训练多个模型和推理时增强进行融合。
|
||||
|
||||
|
||||
1.使用llama-factory对九格模型进行全参数微调。数据集见dataset
|
||||
训练代码:
|
||||
LLaMA-Factory.zip 解压后使用,可参照https://github.com/hiyouga/LLaMA-Factory配置环境,或将代码映射到docker中使用。
|
||||
训练:train.sh。将数据集放到LLaMA-Factory/data文件夹下,将train.sh放到LLaMA-Factory下使用。
|
||||
推理: python inference.py(需在inference.py中修改好模型路径。) test_case.json是从题目中提取出来的测试用例。
|
||||
|
||||
2.训练和推理都已验证无误,在A100*8卡机器上。
|
||||
docker 启动:sudo docker run -it --runtime=nvidia --gpus all --shm-size=256g wjf:train
|
||||
推理:python inference.py
|
||||
训练:
|
||||
cd training
|
||||
sh training.sh
|
||||
百度网盘需要收费,使用阿里云盘
|
||||
model_wight:通过百度网盘分享的文件:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
https://www.alipan.com/s/FTPWUSBuz7s
|
||||
|
||||
docker:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
https://www.alipan.com/s/FTPWUSBuz7s
|
||||
|
||||
3.推理使用多checkpoint、多次推理融合。
|
||||
|
||||
4.所有资料都已打包进docker,只需要docker即可。
|
||||
|
||||
5.启动训练时将覆盖提交的checkpoint。
|
||||
|
||||
6.docker卡在数据处理可能是机器的问题,尝试docker中输入:
|
||||
export NCCL_DEBUG=INFO
|
||||
export NCCL_SHM_DISABLE=1
|
||||
export NCCL_P2P_DISABLE=1
|
||||
由于需要保存多个checkpoint,请务必保证磁盘空间足够,大于500G。
|
||||
|
||||
7.提交不易,请有问题是及时联系我(电话:13121813131)
|
||||
train_data:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
https://www.alipan.com/s/FTPWUSBuz7s
|
20
inference.py
20
inference.py
|
@ -211,11 +211,10 @@ def get_result_1(model, tokenizer):
|
|||
|
||||
|
||||
answers = {}
|
||||
|
||||
for model_path in [
|
||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all/TACO/",
|
||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new_2/CodeNet4Repair/",
|
||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new_1/CodeExercise-Python-27k/",
|
||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new_1/checkpoint-600",
|
||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new/checkpoint-600/",
|
||||
|
||||
]:
|
||||
print("model_path: ", model_path)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
|
@ -235,21 +234,14 @@ for model_path in [
|
|||
test, score = exec_code(test)
|
||||
answers[score] = test
|
||||
|
||||
'''
|
||||
import os
|
||||
for path in os.listdir("./"):
|
||||
if "home-wujianfeng" in path:
|
||||
with open(path, "r") as f:
|
||||
test = json.load(f)
|
||||
answers[float(path.split(".")[-2].split("-")[-1])] = test
|
||||
'''
|
||||
|
||||
|
||||
answers = list(dict(sorted(answers.items())).values())
|
||||
print("answers: ", answers)
|
||||
right = 0
|
||||
jiuge_right = 0
|
||||
merge = []
|
||||
for i in range(len(answers[0])):
|
||||
for i in range(len(answers)):
|
||||
#for i in range(2):
|
||||
flag = 0
|
||||
for answer in answers:
|
||||
|
@ -265,7 +257,7 @@ for i in range(len(answers[0])):
|
|||
|
||||
|
||||
|
||||
print(right / len(answers[0]), jiuge_right / len(answers[0]))
|
||||
print(right / len(answers), jiuge_right / len(answers))
|
||||
with open("wjf_jiuge.jsonl", "w") as f:
|
||||
for item in merge:
|
||||
item.pop("result")
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
model_wight:通过百度网盘分享的文件:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
#https://www.alipan.com/s/FTPWUSBuz7s
|
||||
|
||||
docker:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
#https://www.alipan.com/s/FTPWUSBuz7s
|
||||
|
||||
train_data:
|
||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
||||
提取码:6666
|
||||
#https://www.alipan.com/s/FTPWUSBuz7s
|
Loading…
Reference in New Issue