【求助帖】 训练管理中保存的模型找不到 #170

Closed
opened 2024-10-09 17:35:12 +08:00 by 12390900721cs · 1 comment

观察一下使用到的一些模型的路径:

模型,在/dataset/Llama-3-8B-Instruct/路径下

数据,在/code/internlm_Agent-FLAN_data

转换后数据,/code/data_converted

已训练模型:/dataset/llama3-8b-functioncall-ft/agent-flan

自己微调后:/userhome/llama3-8b-ft/agent-flan这指定了工作目录,所有训练相关的输出(如模型检查点和日志)将被保存在这里。

后续将/dataset/llama3-8b-functioncall-ft/agent-flan/中的iter_4296.pth(已训练)转换格式并且移动到/code/llama3-8b-ft/agent-flan/iter_4296_hf

合并后:/code/llama3-8b-ft/agent-flan/merged

查看run.sh,可以看到训练脚本规定会将训练日志和模型等输出保存在/userhome/llama3-8b-ft/agent-flan目录下:

训练完成后,查看/userhome/llama3-8b-ft/agent-flan,并不存在与/dataset/llama3-8b-functioncall-ft/agent-flan中类似的iter_4296.pth文件。

是不是不能写入文件到/userhome/llama3-8b-ft/agent-flan中?

尝试能否将文件保存到/userhome/llama3-8b-ft/agent-flan中

成功保存。

会不会是llama3_8b_instruct_qlora_agentflan_3e.py中规定了其他路径?

run.sh中最后的训练代码为:

NPROC_PER_NODE=${GPU} NNODES=${WORLD_SIZE} PORT=${MASTER_PORT} ADDR=${MASTER_ADDR} NODE_RANK=${RANK} xtuner train /code/${TRAIN_CONFIG} --work-dir /userhome/llama3-8b-ft/agent-flan --deepspeed deepspeed_zero3_offload

而调用run.sh的代码为:

bash run.sh llama3_8b_instruct_qlora_agentflan_3e.py 6

本质上还是用run.sh跑llama3_8b_instruct_qlora_agentflan_3e.py文件。查看llama3_8b_instruct_qlora_agentflan_3e.py文件,并没有发现规定下载路径的代码,只有一个

# Save
save_steps = 500
save_total_limit = 50  # Maximum checkpoints to keep (-1 means unlimited)

# configure default hooks
default_hooks = dict(
    ...
    # save checkpoint per `save_steps`.
    checkpoint=dict(
        type=CheckpointHook,
        save_optimizer=False,
        by_epoch=False,
        interval=save_steps,
        max_keep_ckpts=save_total_limit),
    ...
)

规定了存储点和存储时机的问题。

最关键的还是run.sh中用xtuner train指定的工作目录的这一行:

--work-dir /userhome/llama3-8b-ft/agent-flan

意味着所有的输出,包括模型检查点,将会被保存在这个目录下。

但是就是保存不到,求解答。

观察一下使用到的一些模型的路径: 模型,在/dataset/Llama-3-8B-Instruct/路径下 数据,在/code/internlm_Agent-FLAN_data 转换后数据,/code/data_converted 已训练模型:/dataset/llama3-8b-functioncall-ft/agent-flan 自己微调后:/userhome/llama3-8b-ft/agent-flan这指定了工作目录,所有训练相关的输出(如模型检查点和日志)将被保存在这里。 后续将/dataset/llama3-8b-functioncall-ft/agent-flan/中的iter_4296.pth(已训练)转换格式并且移动到/code/llama3-8b-ft/agent-flan/iter_4296_hf 合并后:/code/llama3-8b-ft/agent-flan/merged 查看run.sh,可以看到训练脚本规定会将训练日志和模型等输出保存在/userhome/llama3-8b-ft/agent-flan目录下: ![](https://cdn.nlark.com/yuque/0/2024/png/48516026/1728464458047-b13b1dbb-49b1-4300-b79d-dae2e604bae3.png) 训练完成后,查看/userhome/llama3-8b-ft/agent-flan,并不存在与/dataset/llama3-8b-functioncall-ft/agent-flan中类似的iter_4296.pth文件。 ![](https://cdn.nlark.com/yuque/0/2024/png/48516026/1728464928609-cf0a68d5-3065-42a5-88be-9c1506802955.png) ![](https://cdn.nlark.com/yuque/0/2024/png/48516026/1728464783702-e594be92-2a79-4269-bfbf-d2f72dfcefc5.png) ## 是不是不能写入文件到/userhome/llama3-8b-ft/agent-flan中? 尝试能否将文件保存到/userhome/llama3-8b-ft/agent-flan中 ![](https://cdn.nlark.com/yuque/0/2024/png/48516026/1728464126415-d657088d-9b96-4497-95a6-42c5ad5e2679.png) ![](https://cdn.nlark.com/yuque/0/2024/png/48516026/1728464340164-621b3847-e3bd-4bb4-a898-db1344245427.png) 成功保存。 ## 会不会是llama3_8b_instruct_qlora_agentflan_3e.py中规定了其他路径? run.sh中最后的训练代码为: ```plain NPROC_PER_NODE=${GPU} NNODES=${WORLD_SIZE} PORT=${MASTER_PORT} ADDR=${MASTER_ADDR} NODE_RANK=${RANK} xtuner train /code/${TRAIN_CONFIG} --work-dir /userhome/llama3-8b-ft/agent-flan --deepspeed deepspeed_zero3_offload ``` 而调用run.sh的代码为: ```plain bash run.sh llama3_8b_instruct_qlora_agentflan_3e.py 6 ``` 本质上还是用run.sh跑llama3_8b_instruct_qlora_agentflan_3e.py文件。查看llama3_8b_instruct_qlora_agentflan_3e.py文件,并没有发现规定下载路径的代码,只有一个 ```plain # Save save_steps = 500 save_total_limit = 50 # Maximum checkpoints to keep (-1 means unlimited) ``` 和 ```plain # configure default hooks default_hooks = dict( ... # save checkpoint per `save_steps`. checkpoint=dict( type=CheckpointHook, save_optimizer=False, by_epoch=False, interval=save_steps, max_keep_ckpts=save_total_limit), ... ) ``` 规定了存储点和存储时机的问题。 最关键的还是run.sh中用xtuner train<font style="color:rgb(6, 6, 7);">指定的工作目录的这一行:</font> ```python --work-dir /userhome/llama3-8b-ft/agent-flan ``` <font style="color:rgb(6, 6, 7);">意味着所有的输出,包括模型检查点,将会被保存在这个目录下。</font> <font style="color:rgb(6, 6, 7);"></font> <font style="color:rgb(6, 6, 7);">但是就是保存不到,求解答。</font>
Author

已解决

已解决
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: HswOAuth/llm_course#170
No description provided.