网站建设与网页设计专业,做网站用什么电脑好,免费企业宣传片制作软件,富锦建设局网站文章目录 关于 open-instruct设置训练微调偏好调整RLVR 污染检查开发中仓库结构 致谢 关于 open-instruct
github : https://github.com/allenai/open-instruct
这个仓库是我们对在公共数据集上对流行的预训练语言模型进行指令微调的开放努力。我们发布这个仓库#xff0c;并… 文章目录 关于 open-instruct设置训练微调偏好调整RLVR 污染检查开发中仓库结构 致谢 关于 open-instruct
github : https://github.com/allenai/open-instruct
这个仓库是我们对在公共数据集上对流行的预训练语言模型进行指令微调的开放努力。我们发布这个仓库并将持续更新它包括
使用最新技术和指令数据集统一格式微调语言模型的代码。在一系列基准上运行标准评估的代码旨在针对这些语言模型的多种能力。我们在探索中构建的检查点或其他有用的工件。
请参阅我们的第一篇论文 How Far Can Camels Go? Exploring the State of Instruction Tuning on Open Resources 关于这个项目背后的更多想法以及我们的初步发现请参阅我们的第二篇论文。 Camels in a Changing Climate: Enhancing LM Adaptation with Tulu 2 关于使用Llama-2模型和直接偏好优化的结果。我们仍在开发更多模型。有关涉及PPO和DPO的更近期的结果请参阅我们的第三篇论文 Unpacking DPO and PPO: Disentangling Best Practices for Learning from Preference Feedback 设置
我们的设置大部分遵循我们的 Dockerfile , 使用 Python 3.10。注意Open Instruct 是一个研究代码库不保证向后兼容性。 我们提供两种安装策略
本地安装这是推荐安装 Open Instruct 的方式。您可以通过运行以下命令安装依赖项
pip install --upgrade pip setuptools70.0.0 wheel
# TODO, unpin setuptools when this issue in flash attention is resolved
pip install torch2.4.0 torchvision0.19.0 torchaudio2.4.0 --index-url https://download.pytorch.org/whl/cu121
pip install packaging
pip install flash-attn2.6.3 --no-build-isolation
pip install -r requirements.txt
python -m nltk.downloader punkt
pip install -e .Docker 安装: 您也可以使用 Dockerfile 来构建 Docker 镜像。您可以使用以下命令来构建镜像
docker build --build-arg CUDA12.1.0 --build-arg TARGETcudnn8-devel --build-arg DISTubuntu20.04 . -t open_instruct_dev
# if you are interally at AI2, you can create an image like this:
beaker image delete $(whoami)/open_instruct_dev
beaker image create open_instruct_dev -n open_instruct_dev -w ai2/$(whoami)如果您在 AI2 内部您可以使用我们始终最新的自动构建镜像来启动实验nathanl/open_instruct_auto。 训练
设置好环境后您就可以开始一些实验了。我们在下面提供了一些示例。要了解有关如何重现Tulu 3模型的更多信息请参阅Tulu 3自述文件。Tulu 1和Tulu 2的说明和文档在Tulu 1和2自述文件中。 微调
您可以使用以下命令开始
# quick debugging run using 1 GPU
sh scripts/finetune_with_accelerate_config.sh 1 configs/train_configs/sft/mini.yaml
# train an 8B tulu3 model using 8 GPU
sh scripts/finetune_with_accelerate_config.sh 8 configs/train_configs/tulu3/tulu3_sft.yaml偏好调整
# quick debugging run using 1 GPU
sh scripts/dpo_train_with_accelerate_config.sh 1 configs/train_configs/dpo/mini.yaml
# train an 8B tulu3 model using 8 GPU
sh scripts/finetune_with_accelerate_config.sh 8 configs/train_configs/tulu3/tulu3_dpo_8b.yamlRLVR
# quick debugging run using 2 GPU (1 for inference, 1 for training)
# here we are using HuggingFaceTB/SmolLM2-360M-Instruct; its prob not
# gonna work, but its easy to test run and print stuff.
python open_instruct/ppo_vllm_thread_ray_gtrl.py \--dataset_mixer {ai2-adapt-dev/gsm8k_math_ifeval_ground_truth_mixed: 1.0} \--dataset_train_splits train \--dataset_eval_mixer {ai2-adapt-dev/gsm8k_math_ground_truth: 1.0} \--dataset_eval_splits test \--max_token_length 2048 \--max_prompt_token_length 2048 \--response_length 2048 \--model_name_or_path HuggingFaceTB/SmolLM2-360M-Instruct \--reward_model_path HuggingFaceTB/SmolLM2-360M-Instruct \--non_stop_penalty \--stop_token eos \--temperature 1.0 \--ground_truths_key ground_truth \--chat_template tulu \--sft_messages_key messages \--learning_rate 3e-7 \--total_episodes 10000 \--penalty_reward_value -10.0 \--deepspeed_stage 3 \--per_device_train_batch_size 2 \--local_rollout_forward_batch_size 2 \--local_mini_batch_size 32 \--local_rollout_batch_size 32 \--num_epochs 1 \--actor_num_gpus_per_node 1 \--vllm_tensor_parallel_size 1 \--beta 0.05 \--apply_verifiable_reward true \--output_dir output/rlvr_1b \--seed 3 \--num_evals 3 \--save_freq 100 \--reward_model_multiplier 0.0 \--gradient_checkpointing \--with_tracking# train an 8B tulu3 model using 8 GPU (1 for inference, 7 for training)
python open_instruct/ppo_vllm_thread_ray_gtrl.py \--dataset_mixer {ai2-adapt-dev/gsm8k_math_ifeval_ground_truth_mixed: 1.0} \--dataset_train_splits train \--dataset_eval_mixer {ai2-adapt-dev/gsm8k_math_ground_truth: 1.0} \--dataset_eval_splits test \--max_token_length 2048 \--max_prompt_token_length 2048 \--response_length 2048 \--model_name_or_path allenai/Llama-3.1-Tulu-3-8B-DPO \--reward_model_path allenai/Llama-3.1-Tulu-3-8B-RM \--non_stop_penalty \--stop_token eos \--temperature 1.0 \--ground_truths_key ground_truth \--chat_template tulu \--sft_messages_key messages \--learning_rate 3e-7 \--total_episodes 10000000 \--penalty_reward_value -10.0 \--deepspeed_stage 3 \--per_device_train_batch_size 2 \--local_rollout_forward_batch_size 2 \--local_mini_batch_size 32 \--local_rollout_batch_size 32 \--actor_num_gpus_per_node 7 \--vllm_tensor_parallel_size 1 \--beta 0.05 \--apply_verifiable_reward true \--output_dir output/rlvr_8b \--seed 3 \--num_evals 3 \--save_freq 100 \--reward_model_multiplier 0.0 \--gradient_checkpointing \--with_tracking污染检查
我们发布了用于测量指令调整数据集和评估数据集之间重叠的脚本./decontamination。有关更多详细信息请参阅自述文件。 开发中
当向此仓库提交PR时我们使用以下方式检查open_instruct/中的核心代码样式
make style
make quality仓库结构
├── assets/ - Images, licenses, etc.
├── configs/
| ├── beaker_configs/ - AI2 Beaker configs
| ├── ds_configs/ - DeepSpeed configs
| └── train_configs/ - Training configs
├── decontamination/ - Scripts for measuring train-eval overlap
├── eval/ - Evaluation suite for fine-tuned models
├── human_eval/ - Human evaluation interface (not maintained)
├── open_instruct/ - Source code (flat)
├── quantize/ - Scripts for quantization
├── scripts/ - Core training and evaluation scripts
└── Dockerfile - Dockerfile致谢
Open Instruct 是一个受益于许多开源项目和库的项目。我们特别感谢以下项目
HuggingFace Transformers : 我们为微调脚本适配了 Hugging Face 的 Trainer。HuggingFace TRL 和 eric-mitchell/direct-preference-optimization : 我们的偏好调整代码改编自 TRL 和 Eric Mitchell 的 DPO 代码。
OpenAI 的 lm-human-preferences, summarize-from-feedback, 和vwxyzjn/summarize_from_feedback_details : 我们的核心PPO代码是从OpenAI的原始RLHF代码改编而来。 Huang et al (2024)s reproduction work 关于OpenAI的基于反馈的总结工作的内容。OpenRLHF : 我们将 OpenRLHF 的 Ray vLLM 分布式代码进行了适配以扩展 PPO RLVR 训练至 70B 规模。