This is an LLM fine-tuning pipeline for Apple Silicon GPUs using MLX. The project enables:
Data Collection & Preparation:
Web scraping with scripts/web_scraper.py to extract content from websites (like Wikipedia)
Data preprocessing with scripts/prepare_jsonl_data.py to convert scraped CSV data into JSONL training format
Model Training:
Fine-tuning the mlx-community/Ministral-8B-Instruct-2410-4bit model using LoRA (Low-Rank Adaptation)
Training script scripts/train.sh with configurable parameters (batch size, iterations, learning rate)
Testing capabilities via scripts/test.sh
Key Features:
Optimized for Apple Silicon using MLX framework LoRA fine-tuning for efficient training with limited resources Multiple data formats supported (Q&A, instruction-following, chat) Automated pipeline from web scraping to model inference
Workflow:
- Scrape web content → CSV
- Convert CSV → JSONL training data
- Fine-tune model with LoRA
- Generate responses with the adapted model
The project is designed for creating domain-specific AI assistants by training on custom web content.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtYou need huggingface account and token to download the model.
hf auth login
hf download mlx-community/Ministral-8B-Instruct-2410-4bitpython ./scripts/web_scraper.py https://en.wikipedia.org/wiki/Yugoslavia -p 20 -o dataset/data.csvpython ./scripts/prepare_jsonl_data.py dataset/data.csv./scripts/train.sh./scripts/test.shExample inference:
./scripts/run.sh "Explain the history of the Balkans"or
./scripts/run.sh "Who was the president of Yugoslavia?"