forked from p83651209/CPM-9G-8B
Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
p83651209 | 1033ad4a75 | |
p83651209 | b63fcef8d2 | |
p83651209 | db10b9114b | |
p83651209 | 58a7967a98 | |
p83651209 | cd1bdcf117 | |
p83651209 | 4c8196bc84 | |
p83651209 | 124160cb1e |
41
README.md
41
README.md
|
@ -1,24 +1,27 @@
|
||||||
方案:
|
夸克网盘 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卡机器上。
|
||||||
model_wight:通过百度网盘分享的文件:
|
docker 启动:sudo docker run -it --runtime=nvidia --gpus all --shm-size=256g wjf:train
|
||||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
推理:python inference.py
|
||||||
提取码:6666
|
训练:
|
||||||
https://www.alipan.com/s/FTPWUSBuz7s
|
cd training
|
||||||
|
sh training.sh
|
||||||
|
|
||||||
docker:
|
|
||||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
|
||||||
提取码:6666
|
|
||||||
https://www.alipan.com/s/FTPWUSBuz7s
|
|
||||||
|
|
||||||
train_data:
|
3.推理使用多checkpoint、多次推理融合。
|
||||||
链接:https://pan.baidu.com/s/1paYNO7d5OYESuyw3BVo7Ew
|
|
||||||
提取码:6666
|
4.所有资料都已打包进docker,只需要docker即可。
|
||||||
https://www.alipan.com/s/FTPWUSBuz7s
|
|
||||||
|
5.启动训练时将覆盖提交的checkpoint。
|
||||||
|
|
||||||
|
6.docker卡在数据处理可能是机器的问题,尝试docker中输入:
|
||||||
|
export NCCL_DEBUG=INFO
|
||||||
|
export NCCL_SHM_DISABLE=1
|
||||||
|
export NCCL_P2P_DISABLE=1
|
||||||
|
由于需要保存多个checkpoint,请务必保证磁盘空间足够,大于500G。
|
||||||
|
|
||||||
|
7.提交不易,请有问题是及时联系我(电话:13121813131)
|
20
inference.py
20
inference.py
|
@ -211,10 +211,11 @@ def get_result_1(model, tokenizer):
|
||||||
|
|
||||||
|
|
||||||
answers = {}
|
answers = {}
|
||||||
for model_path in [
|
|
||||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new_1/checkpoint-600",
|
|
||||||
"/mnt/disk2/home/wujianfeng/LLaMA-Factory/all_new/checkpoint-600/",
|
|
||||||
|
|
||||||
|
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/",
|
||||||
]:
|
]:
|
||||||
print("model_path: ", model_path)
|
print("model_path: ", model_path)
|
||||||
model = AutoModelForCausalLM.from_pretrained(
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
@ -234,14 +235,21 @@ for model_path in [
|
||||||
test, score = exec_code(test)
|
test, score = exec_code(test)
|
||||||
answers[score] = 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())
|
answers = list(dict(sorted(answers.items())).values())
|
||||||
print("answers: ", answers)
|
print("answers: ", answers)
|
||||||
right = 0
|
right = 0
|
||||||
jiuge_right = 0
|
jiuge_right = 0
|
||||||
merge = []
|
merge = []
|
||||||
for i in range(len(answers)):
|
for i in range(len(answers[0])):
|
||||||
#for i in range(2):
|
#for i in range(2):
|
||||||
flag = 0
|
flag = 0
|
||||||
for answer in answers:
|
for answer in answers:
|
||||||
|
@ -257,7 +265,7 @@ for i in range(len(answers)):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print(right / len(answers), jiuge_right / len(answers))
|
print(right / len(answers[0]), jiuge_right / len(answers[0]))
|
||||||
with open("wjf_jiuge.jsonl", "w") as f:
|
with open("wjf_jiuge.jsonl", "w") as f:
|
||||||
for item in merge:
|
for item in merge:
|
||||||
item.pop("result")
|
item.pop("result")
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
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