This repository contains a fine-tuned version of the meta-llama/Llama-3.1-8B model using LoRA (Low-Rank Adaptation) on an Apple MacBook Pro M3 with 36GB RAM, leveraging the MPS (Metal Performance Shaders) backend. The model was trained on a custom dataset (training_data.txt) to generate explanations or commands, and all necessary files are included for easy setup and deployment with Ollama.
- Base Model:
meta-llama/Llama-3.1-8B - Fine-Tuning Method: LoRA with
r=16,lora_alpha=64, and target modules["q_proj", "v_proj", "k_proj", "o_proj"] - Hardware: MacBook Pro M3 with MPS acceleration
- Training Data: 91 examples in
training_data.txt - Date Completed: June 26, 2025
train_ocg.py: Python script used to fine-tune the model.fine_tuned_llama_m3/: Directory with fine-tuned LoRA adapter weights and tokenizer:adapter_model.safetensors(54.5MB): Fine-tuned LoRA weights.adapter_config.json: LoRA configuration.tokenizer.json(17.2MB),tokenizer_config.json,special_tokens_map.json: Tokenizer files.
training_data.txt: The dataset used for fine-tuning (91 examples).merge_model.py: Script to merge the adapter with the base model.
- Operating System: macOS (tested on MacBook Pro M3).
- Python: Version 3.9 or higher.
- Homebrew: Install if not present (
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"). - Ollama: Install via Homebrew (
brew install ollama).
- Set up a isolated Python environment:
python3 -m venv ocg_env source ocg_env/bin/activate pip3 install transformers peft datasets torch torchvision