From 665051a3878f2d3abe90f2f7d1d9703ca6069bd8 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Thu, 24 Jul 2025 23:37:32 +0200 Subject: [PATCH 1/3] Add instructions for the post-training steps --- recipes/smollm3/README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/recipes/smollm3/README.md b/recipes/smollm3/README.md index 83559ce6..81b3198e 100644 --- a/recipes/smollm3/README.md +++ b/recipes/smollm3/README.md @@ -1,10 +1,21 @@ # Instructions to train SmolLM3-3B -We are open-sourcing all the artifacts to train [SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B). You can find the configuration files for the three post-training stages in the [`sft`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/sft) and [`dpo`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/dpo) directories. - -We are currently working on the code release, so this README will contain the instructions to run training after we release the code on the week of July 14, 2025. +We are open-sourcing all the artifacts to train [SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B). You can find the configuration files for the three post-training stages (mid-training, SFT, and DPO) in the [`sft`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/sft) and [`dpo`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/dpo) directories. ## Setup -[WIP] \ No newline at end of file +Make sure you followed the installation instructions on the [README.md](README.md) file. We tested the training setup 8 GPUs (80GB of VRAM) to train the full model. + +## Full training examples + +```shell +# Step 1 - Mid-Training +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/mid.yaml + +# Step 2 - SFT +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/sft.yaml + +# Step 2 - DPO +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/dpo.py --config recipes/smollm3/dpo/apo.yaml +``` \ No newline at end of file From 1f7e47962d986b2d8d70ba56f2590b2773561fd9 Mon Sep 17 00:00:00 2001 From: cmpatino Date: Thu, 24 Jul 2025 23:41:16 +0200 Subject: [PATCH 2/3] Minor grammar and spaces corrections --- recipes/smollm3/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/recipes/smollm3/README.md b/recipes/smollm3/README.md index 81b3198e..ad3ba672 100644 --- a/recipes/smollm3/README.md +++ b/recipes/smollm3/README.md @@ -1,11 +1,10 @@ - # Instructions to train SmolLM3-3B We are open-sourcing all the artifacts to train [SmolLM3-3B](https://huggingface.co/HuggingFaceTB/SmolLM3-3B). You can find the configuration files for the three post-training stages (mid-training, SFT, and DPO) in the [`sft`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/sft) and [`dpo`](https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm3/dpo) directories. ## Setup -Make sure you followed the installation instructions on the [README.md](README.md) file. We tested the training setup 8 GPUs (80GB of VRAM) to train the full model. +Make sure you followed the installation instructions in the [README.md](README.md) file. We tested the training setup with 8 GPUs (80GB of VRAM) to train the full model. ## Full training examples From 61d7a82ac7f29a8d3b626e8dea730ebf7dc0de2d Mon Sep 17 00:00:00 2001 From: cmpatino Date: Tue, 29 Jul 2025 12:06:06 +0200 Subject: [PATCH 3/3] Specify GAS parameter to have the correct EBS on 1 node --- recipes/smollm3/README.md | 6 +++--- recipes/smollm3/sft/sft.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/smollm3/README.md b/recipes/smollm3/README.md index ad3ba672..90e9973d 100644 --- a/recipes/smollm3/README.md +++ b/recipes/smollm3/README.md @@ -10,11 +10,11 @@ Make sure you followed the installation instructions in the [README.md](README.m ```shell # Step 1 - Mid-Training -ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/mid.yaml +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/mid.yaml --gradient_accumulation_steps 16 # Step 2 - SFT -ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/sft.yaml +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/sft.py --config recipes/smollm3/sft/sft.yaml --gradient_accumulation_steps 16 # Step 2 - DPO -ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/dpo.py --config recipes/smollm3/dpo/apo.yaml +ACCELERATE_LOG_LEVEL=info accelerate launch --config_file recipes/accelerate_configs/zero3.yaml scripts/dpo.py --config recipes/smollm3/dpo/apo.yaml --gradient_accumulation_steps 4 ``` \ No newline at end of file diff --git a/recipes/smollm3/sft/sft.yaml b/recipes/smollm3/sft/sft.yaml index d0be5024..993c9a04 100644 --- a/recipes/smollm3/sft/sft.yaml +++ b/recipes/smollm3/sft/sft.yaml @@ -1,4 +1,4 @@ -# Config for 8 nodes +# Config for 8 nodes with GBS 128 # Model arguments model_name_or_path: HuggingFaceTB/SmolLM3-3B-checkpoints model_revision: it-mid-training