Spaces:
Runtime error
Runtime error
File size: 6,005 Bytes
dc2b56f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
---
title: Finetune-Test
app_file: ui.py
sdk: gradio
sdk_version: 5.23.2
---
# LLM Finetuner
This project provides a user-friendly interface for fine-tuning Large Language Models (LLMs) using the Unsloth library. It includes features for dataset preparation, synthetic dataset creation, model training, testing, and GGUF conversion.
## Features
- Load and fine-tune various pre-trained models
- Prepare existing datasets or create synthetic datasets
- Fine-tune models with customizable hyperparameters
- Test fine-tuned models
- Convert models to GGUF format for deployment
## Prerequisites
- Python 3.8 or higher
- CUDA-capable GPU (for efficient training)
## Installation
1. Clone the repository:
```
git clone https://github.com/yourusername/llm-finetuner.git
cd llm-finetuner
```
2. Create a virtual environment (optional but recommended):
```
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
```
3. Install the required packages:
```
pip install -r requirements.txt
```
## Usage
1. Run the application:
```
python main.py
```
2. Open the provided URL in your web browser to access the Gradio interface.
3. Follow these steps in the interface:
a. Settings: Enter your Hugging Face token and select a model.
b. Dataset: Prepare an existing dataset or create a synthetic one.
c. Training: Set hyperparameters and start the fine-tuning process.
d. Test: Test your fine-tuned model with custom inputs.
e. GGUF Conversion: Convert your model to GGUF format if needed.
## Notes
- Ensure you have the necessary API keys for OpenAI or Anthropic if you plan to use them for synthetic dataset creation.
- If using Ollama for local generation, make sure it's installed and running on your machine.
- Fine-tuning can be computationally intensive. Ensure you have adequate GPU resources available.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License.
# Comprehensive Python Setup Guide
This guide will walk you through setting up Python, creating a virtual environment, and running your LLM Finetuner project on a new system.
## 1. Install Python
### Windows:
1. Go to https://www.python.org/downloads/windows/
2. Download the latest Python 3.x installer (64-bit version recommended)
3. Run the installer
4. Check "Add Python to PATH" during installation
5. Click "Install Now"
### macOS:
1. Install Homebrew if you haven't already:
```
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
2. Install Python using Homebrew:
```
brew install python
```
### Linux (Ubuntu/Debian):
1. Update package list:
```
sudo apt update
```
2. Install Python:
```
sudo apt install python3 python3-pip python3-venv
```
## 2. Verify Python Installation
Open a terminal (Command Prompt on Windows) and run:
```
python --version
```
You should see the Python version number. If not, try `python3 --version`.
## 3. Install Git
### Windows:
1. Go to https://git-scm.com/download/win
2. Download and run the installer
3. Use the default settings during installation
### macOS:
If you installed Homebrew earlier:
```
brew install git
```
### Linux (Ubuntu/Debian):
```
sudo apt install git
```
## 4. Clone the Repository
1. Open a terminal
2. Navigate to where you want to store the project
3. Clone the repository:
```
git clone https://github.com/yourusername/llm-finetuner.git
cd llm-finetuner
```
## 5. Create and Activate a Virtual Environment
### Windows:
```
python -m venv venv
venv\Scripts\activate
```
### macOS and Linux:
```
python3 -m venv venv
source venv/bin/activate
```
Your prompt should change to indicate that the virtual environment is active.
## 6. Install Required Packages
With the virtual environment activated:
```
pip install -r requirements.txt
```
This may take a while as it installs all necessary dependencies.
## 7. Set Up CUDA (for GPU support)
If you have an NVIDIA GPU and want to use it for training:
1. Go to https://developer.nvidia.com/cuda-downloads
2. Download and install the CUDA Toolkit appropriate for your system
3. Install the cuDNN library:
- Go to https://developer.nvidia.com/cudnn
- Download cuDNN (you may need to create an NVIDIA account)
- Follow the installation instructions for your system
## 8. Run the Application
With the virtual environment still activated:
```
python main.py
```
This will start the Gradio interface. Open the provided URL in your web browser.
## 9. Using the LLM Finetuner
1. In the "Settings" tab:
- Enter your Hugging Face token
- Select a model
2. In the "Dataset" tab:
- Prepare an existing dataset or create a synthetic one
3. In the "Training" tab:
- Set hyperparameters and start training
4. In the "Test" tab:
- Test your fine-tuned model
5. In the "GGUF Conversion" tab:
- Convert your model to GGUF format if needed
## Troubleshooting
- If `python` doesn't work, try `python3`
- Ensure your GPU drivers are up to date for CUDA support
- If you encounter "command not found" errors, ensure the relevant programs are in your system's PATH
## Closing Notes
- Always activate the virtual environment before running the project
- To deactivate the virtual environment, simply type `deactivate` in the terminal
- Keep your Python packages updated with `pip install --upgrade -r requirements.txt`
Remember to keep your API keys and tokens secure. Happy fine-tuning!
## Alternative, installation
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install triton
pip install unsloth gradio transformers datasets tqdm |