This example demonstrates how to use eval_protocol to fetch GSM8K data and train a model using tinker's RL training loop.
- Tinker Cookbook: Ensure
tinker-cookbookis available. The script attempts to add../../../tinker-cookbooktosys.path. - Eval Protocol: Ensure
eval-protocolis installed with HuggingFace support.pip install 'eval-protocol[huggingface]' - Tinker API Key: You need a Tinker API key.
export TINKER_API_KEY=your_api_key_here
Run the training script with python. We recommend using a small model for testing, such as Qwen/Qwen3-4B-Instruct-2507.
# Install dependencies
pip install 'eval-protocol[huggingface]' chz tinker
# Run training
export TINKER_API_KEY=your_api_key_here
python train.py model_name="Qwen/Qwen3-4B-Instruct-2507" groups_per_batch=4 train_limit=100 test_limit=10model_name: The model to train (e.g.,Qwen/Qwen3-4B-Instruct-2507).groups_per_batch: Batch size (default: 100).group_size: Number of samples per problem (default: 4).train_limit: Number of training examples to fetch (default: 1000).test_limit: Number of test examples to fetch (default: 100).log_path: Path to save logs and checkpoints.
- Data Loading: The script uses
eval_protocol.adapters.huggingface.create_gsm8k_adapterto fetch GSM8K data. - Dataset Adaptation:
EvalProtocolGsm8kDatasetconvertsEvaluationRowobjects fromeval_protocolintoProblemGroupBuilderobjects expected bytinker. - Training: The standard
tinkertraining loop is used to optimize the model.