Verl中的checkpoint合并成huggingface形式的模型
2026/5/13 6:10:03 网站建设 项目流程

这里用的fsdp训练的模型,大概内容如下:

里面打开还是有很多文件

现在想要hf那个格式的模型,VeRL提供了merge函数,下面是一个代码:具体参考https://verl.readthedocs.io/en/latest/advance/checkpoint.html#checkpoint-page

#!/bin/bash # 合并 PPO 训练的 checkpoint 为 HuggingFace 格式 # Checkpoint 路径:/root/autodl-tmp/verl/checkpoints/verl_example_gsm8k/deepseek_llm_7b_function_rm/global_step_105 set-x # 设置 Hugging Face 缓存目录 export HF_HOME=/root/autodl-tmp export TRANSFORMERS_CACHE=/root/autodl-tmp # Checkpoint 路径 CHECKPOINT_DIR="/root/autodl-tmp/verl/checkpoints/verl_example_gsm8k/deepseek_llm_7b_function_rm/global_step_105"ACTOR_DIR="${CHECKPOINT_DIR}/actor"# 输出目录(合并后的 HuggingFace 模型) TARGET_DIR="${CHECKPOINT_DIR}/merged_hf_model"# 执行合并 python-m verl.model_merger merge \--backend fsdp \--local_dir"${ACTOR_DIR}"\--target_dir"${TARGET_DIR}"echo"合并完成!模型已保存到: ${TARGET_DIR}"

合并后的模型如下:

后记

2025年12月12日于上海。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询