Views
No views yet
grpo-countdown-problem/
├── data/ # Training and test datasets
├── models/ # Saved model checkpoints
│ ├── sft/ # SFT model outputs
│ └── grpo/ # GRPO model outputs
├── src/
│ ├── config/ # Configuration files
│ │ ├── grpo/ # GRPO training configs
│ │ └── sft/ # SFT training configs
│ ├── dataset/ # Dataset loading and processing
│ ├── examples/ # Example scripts for inference
│ ├── scripts/ # Data generation and processing
│ ├── training/ # Training scripts
│ │ ├── grpo/ # GRPO training
│ │ └── sft/ # SFT training
│ └── utils/ # Utility functions
├── main.py # Main entry point
├── pyproject.toml # Project dependencies
└── README.md # This file1git clone <repository-url>
2cd grpo-countdown-problem1# Install uv if you haven't already
2curl -LsSf https://astral.sh/uv/install.sh | sh
3
4# Install project dependencies
5uv syncpip install -e .1cp .env.example .env
2# Edit .env and add your OpenAI API key1python src/scripts/generate_training_dataset_sft.py \
2 --output_path data/sft/train.csv \
3 --num_problems 10000 \
4 --num_workers 41python src/scripts/generate_training_dataset_grpo.py \
2 --output_path data/grpo/train.csv \
3 --num_problems 10000 \
4 --num_workers 41python src/scripts/generate_training_dataset_grpo.py \
2 --output_path data/grpo/test.csv \
3 --num_problems 1000 \
4 --num_workers 4id: Unique problem identifierproblem_description: Natural language description of the problemcorrect_answer: The target arithmetic expressionnum1, num2, num3, num4: The four numbers to usereasoning (SFT only): Step-by-step solution explanationpython src/training/sft/train_sft_hydra.pysrc/config/sft/:config.yaml: Main configurationdataset/default.yaml: Dataset settingsmodel/qwen2.5-3b.yaml: Model and LoRA settingstraining/default.yaml: Training hyperparametersQwen/Qwen2.5-Math-1.5Bmodels/sft/python src/training/grpo/train_grpo_hydra.pysrc/config/grpo/:config.yaml: Main configuration (includes SFT model path)dataset/default.yaml: Dataset settingsmodel/qwen2.5-3b.yaml: Model and LoRA settingstraining/default.yaml: Training hyperparametersmodels/sft/models/grpo/1# Override dataset size
2python src/training/sft/train_sft_hydra.py dataset.max_rows=5000
3
4# Override learning rate and batch size
5python src/training/grpo/train_grpo_hydra.py \
6 training.learning_rate=5e-6 \
7 training.per_device_train_batch_size=1
8
9# Use different output directory
10python src/training/sft/train_sft_hydra.py output_dir=models/sft_experimentpython src/examples/run_model.py1python src/examples/calculate_accuracy.py \
2 --csv_path data/grpo/test.csv \
3 --sft_model_path models/sft/ \
4 --grpo_model_path models/grpo/ \
5 --max_samples 100 \
6 --output_path results/evaluation_results.csv--csv_path: Path to test CSV file--sft_model_path: Path to SFT model directory--grpo_model_path: Path to GRPO model directory--max_samples: Limit number of test samples (optional)--output_path: Save detailed results to CSV (optional)--temperature: Sampling temperature (default: 1.0)--max_new_tokens: Maximum tokens to generate (default: 4096)1# Evaluate only SFT model (no GRPO)
2python src/examples/calculate_accuracy.py \
3 --csv_path data/grpo/test.csv \
4 --sft_model_path models/sft/ \
5 --no_grpo
6
7# Evaluate only base model (no SFT or GRPO)
8python src/examples/calculate_accuracy.py \
9 --csv_path data/grpo/test.csv \
10 --no_sft --no_grpo1# View training logs
2tensorboard --logdir models/sft/runs # For SFT training
3tensorboard --logdir models/grpo/runs # For GRPO training53 + 47 + 36 - 3