https://github.com/edujbarrios/finetuningexamples
This repository demostrate how to make a simple fine tuning on AI LLM models
https://github.com/edujbarrios/finetuningexamples
Last synced: 3 months ago
JSON representation
This repository demostrate how to make a simple fine tuning on AI LLM models
- Host: GitHub
- URL: https://github.com/edujbarrios/finetuningexamples
- Owner: edujbarrios
- Created: 2024-12-18T13:46:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-12-18T14:12:05.000Z (10 months ago)
- Last Synced: 2025-03-01T17:38:10.439Z (7 months ago)
- Language: Jupyter Notebook
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fine-Tuning Llama 3.2 Vision and MoonDream2
---> [!NOTE]
>
> **The notebooks are not ready to drag and run, if you are using the Llama 3.2 version, you will have to modify the model line depending on the version you have downloaded locally, this means, the 1B, 7B or 90B parameter, same as with Moondream, which has a 0.5B version and a 2B version**.## 📂 Included Files
- **`FineTuning_Llama_CatsVsDogs.ipynb`**: Demonstrates fine-tuning using the Llama 3.2 Vision model.
- **`FineTuning_MoonDream2_CatsVsDogs.ipynb`**: Shows the same process with MoonDream2.---
## 🚀 How It Works
### 🐱 Fine-Tuning on `cats_vs_dogs` Dataset
The `cats_vs_dogs` dataset, available on Hugging Face, is used for demonstration. The dataset is divided into two categories (`cats` and `dogs`) and is preprocessed for training.### 📄 Notebook Highlights
1. **Dataset Preparation**:
- Download and preprocess the dataset.
- Images are resized to 224x224 pixels and converted into tensors.2. **Model Setup**:
- Load pre-trained `Llama 3.2 Vision` or `MoonDream2` models.
- Tokenizers are used to handle labels and textual representations.3. **Fine-Tuning**:
- Configure hyperparameters (learning rate, batch size, and epochs).
- Train the model on a subset of the dataset.4. **Evaluation**:
- Evaluate model performance on a validation set.
- Visualize predictions to validate accuracy.### ⚠️ Prerequisite: Model Installation
Both `Llama 3.2 Vision` and `MoonDream2` must be installed and accessible locally before running the notebooks. These models can be downloaded from their respective repositories or Hugging Face.---
## 💻 System Requirements
### 🖥️ Minimum Hardware
- **GPU**: NVIDIA RTX 3090 or higher with at least **24 GB VRAM**.
- **RAM**: 16 GB or more.
- **Storage**: 10 GB free for dataset and model storage.### 🏎️ Recommended Hardware for Fast Performance
- **GPU**: NVIDIA A100 or V100.
- **RAM**: 32 GB or more.
- **Storage**: NVMe SSD for faster I/O.---
## 🔧 Software Requirements
### 🛠️ Dependencies
Both notebooks rely on the following libraries:- Python 3.8 or newer
- `transformers` (Hugging Face)
- `torch` and `torchvision` (PyTorch)
- `unsloth` (for fine-tuning convenience)
- `datasets` (to load and preprocess data)
- `matplotlib` (for visualization)Install all dependencies using:
```bash
pip install transformers torch torchvision unsloth datasets matplotlib
```---
## 📝 Notes
- Fine-tuning large models requires significant computational resources. Make sure your system meets the recommended GPU requirements for reduced training times.
- If GPU memory is insufficient, reduce batch size or switch to mixed precision training (not included in these notebooks).
- Ensure the models are pre-installed before running the notebooks.---