Fine-Tuning Qwen2.5-Math-7B with LoRA (8-bit Quantization)
This repository demonstrates how to fine-tune the Qwen2.5-Math-7B model using LoRA in 8-bit precision for efficient memory usage. The process combines four CSV datasets (main_train.csv
, main_test.csv
, socratic_train.csv
, socratic_test.csv
) and produces a LoRA-adapted model for solving math/algebra problems.
Table of Contents
- Overview
- Requirements
- Installation
- Data Preparation
- Fine-Tuning Steps
- Inference
- Merging LoRA Weights (Optional)
- License
Overview
- Base Model: Qwen2.5-Math-7B
- Parameter-Efficient Fine-Tuning: LoRA (Low-Rank Adaptation)
- Quantization: 8-bit, using bitsandbytes
- Datasets: Four CSV files:
main_train.csv
&main_test.csv
socratic_train.csv
&socratic_test.csv
The code merges these training sets and fine-tunes the model to handle algebraic problem-solving tasks in a memory-efficient manner.
Requirements
- Python 3.8+
- PyTorch (tested with
torch>=2.0.0
) - Transformers (tested with
transformers>=4.30.0
) - PEFT (
peft>=0.4.0
) - Datasets (
datasets>=2.10.0
) - Accelerate (
accelerate>=0.20.0
) - bitsandbytes (
bitsandbytes>=0.39.0
) - pandas (for CSV reading)
Installation
git clone <this-repo-url>
cd <this-repo-folder>
# Install Python dependencies
pip install torch transformers datasets peft accelerate bitsandbytes pandas
## Data Preperation
- main_train.csv
- main_test.csv
- socratic_train.csv
- socratic_test.csv
- Downloads last month
- 0
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
馃檵
Ask for provider support