3.0 KiB
3.0 KiB
Cyron Summary LoRA Training
This directory contains scripts and configurations for training a LoRA adapter on the Cyron summary dataset.
Directory Structure
training/
├── configs/ # Training configurations
│ └── llama2-7b-lora.yaml
├── data/ # Prepared datasets (train/test splits)
├── output/ # Trained model outputs
├── scripts/ # Training and inference scripts
│ ├── prepare_dataset.py
│ ├── train.py
│ └── inference.py
└── notebooks/ # Jupyter notebooks for analysis
Prerequisites
- Python 3.10+
- GPU with 40GB+ VRAM (A100 recommended)
- 64GB+ system RAM
- 100GB+ free disk space
- CUDA drivers installed
Server Deployment (Recommended)
Use the deployment script to clone and train on your GPU server:
# Deploy and train in one command
bash deploy-and-train.sh
This will:
- Clone the repo to
/opt/loras/agenx-lora-training - Setup Python environment with CUDA support
- Prepare the dataset
- Train the LoRA adapter
Manual Setup
1. Prepare Dataset
python scripts/prepare_dataset.py --input ../combined_20k.jsonl --output data
This splits the 20k dataset into train/test sets (95/5).
2. Train Model
python scripts/train.py --config configs/llama2-7b-lora.yaml
Or with custom parameters:
python scripts/train.py --config configs/llama2-7b-lora.yaml --epochs 5 --batch-size 8
Training takes approximately 6-24 hours depending on GPU.
3. Generate Summaries
python scripts/inference.py \
--model output/llama2-7b-lora \
--task "Fix parser crash on malformed JSON" \
--files src/parser.cpp \
--tests-run --test-count 294 \
--commit --push
Configuration
Edit configs/llama2-7b-lora.yaml to adjust:
- Base model: Change
base_modelto use different foundation models - LoRA rank: Adjust
lora_r(higher = more capacity, slower) - Learning rate: Tune
learning_rate - Epochs: Change
num_train_epochs - Batch size: Adjust
per_device_train_batch_size
Dataset Format
The dataset (combined_20k.jsonl) contains 20,000 examples with:
task: Task descriptionfiles_changed: List of changed filestests_run: Booleancommit: Booleanpush: Booleanerrors_seen: Booleantest_count: Number of testsoutput: Expected Cyron summary
Output
Trained model is saved to output/llama2-7b-lora/:
adapter_model.safetensors- LoRA weightsconfig.json- Model configurationtokenizer.json- Tokenizerpeft_config.json- LoRA configuration
Troubleshooting
Out of memory:
- Reduce
per_device_train_batch_size - Enable
gradient_checkpointing: true - Use
load_in_4bit: true(already enabled)
Training loss not decreasing:
- Lower learning rate (try 1e-4)
- Increase warmup ratio
- Check dataset quality
Generation too long/short:
- Adjust
max_new_tokensin inference script - Tune
temperatureandtop_p