Metadata-Version: 2.4
Name: llm-finetuner-pro
Version: 3.3.2
Summary: Advanced LLM Fine-Tuner — SFT, DPO, ORPO, KTO, GRPO, reward modelling and evaluation
Author: Yog-Sotho
License-Expression: GPL-3.0-only
Project-URL: Homepage, https://github.com/Yog-Sotho/LLM-fine-tuner
Project-URL: Repository, https://github.com/Yog-Sotho/LLM-fine-tuner
Project-URL: Issues, https://github.com/Yog-Sotho/LLM-fine-tuner/issues
Keywords: llm,fine-tuning,peft,lora,qlora,dpo,grpo,kto,orpo,rlhf
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: gradio<7,>=6.16.0
Requires-Dist: transformers<6,>=5.10.1
Requires-Dist: datasets<6,>=5.0.1
Requires-Dist: peft<1,>=0.18.0
Requires-Dist: accelerate<2,>=1.15.0
Requires-Dist: bitsandbytes>=0.45.0
Requires-Dist: trl<1.15,>=0.29.1
Requires-Dist: torch<3,>=2.13.0
Requires-Dist: numpy>=2.0.0
Requires-Dist: pandas>=2.2.0
Requires-Dist: safetensors>=0.4.3
Requires-Dist: tqdm>=4.66.3
Requires-Dist: einops>=0.8.0
Requires-Dist: matplotlib>=3.9.0
Requires-Dist: huggingface_hub<3,>=1.5.0
Requires-Dist: typer>=0.15.0
Requires-Dist: pypdf>=6.19.0
Requires-Dist: openpyxl>=3.1.0
Requires-Dist: python-docx>=1.1.0
Requires-Dist: psutil>=6.0.0
Provides-Extra: eval
Requires-Dist: evaluate>=0.4.0; extra == "eval"
Requires-Dist: rouge-score>=0.1.2; extra == "eval"
Requires-Dist: bert-score>=0.3.13; extra == "eval"
Requires-Dist: nlpaug>=1.1.10; extra == "eval"
Requires-Dist: lm-eval<0.5,>=0.4.13; extra == "eval"
Requires-Dist: math-verify>=0.5.2; extra == "eval"
Provides-Extra: vllm
Requires-Dist: trl[vllm]<1.15,>=0.29.1; extra == "vllm"
Provides-Extra: heretic
Requires-Dist: heretic-llm>=1.2.0; extra == "heretic"
Provides-Extra: dev
Requires-Dist: black>=26.3.1; extra == "dev"
Requires-Dist: pytest>=9.0.3; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Provides-Extra: vision
Requires-Dist: torchvision; extra == "vision"
Provides-Extra: compress
Requires-Dist: llmcompressor>=0.14.0; extra == "compress"
Provides-Extra: embedding
Requires-Dist: sentence-transformers<7,>=5.6.0; extra == "embedding"
Provides-Extra: all
Requires-Dist: llm-finetuner-pro[dev,embedding,eval,heretic,vision,vllm]; extra == "all"
Dynamic: license-file

<div align="center">
  <img src="Images/logo.jpg" alt="LLM Fine-Tuner" width="800"/>

  <h1>🧠 LLM Fine-Tuner</h1>

  <p><strong>Your own custom AI — no coding, no PhD, no drama.</strong><br>
  Upload your data → click Train → get a ready-to-use model in minutes.</p>

  <a href="https://github.com/Yog-Sotho/LLM-fine-tuner/stargazers">
    <img src="https://img.shields.io/github/stars/Yog-Sotho/LLM-fine-tuner?style=for-the-badge&logo=github&color=7c3aed" alt="Stars">
  </a>
  <a href="https://github.com/Yog-Sotho/LLM-fine-tuner/blob/main/LICENSE">
    <img src="https://img.shields.io/github/license/Yog-Sotho/LLM-fine-tuner?style=for-the-badge&color=10b981" alt="License">
  </a>
  <a href="https://github.com/Yog-Sotho/LLM-fine-tuner/releases">
    <img src="https://img.shields.io/badge/dynamic/regex?url=https%3A%2F%2Fraw.githubusercontent.com%2FYog-Sotho%2FLLM-fine-tuner%2Fmain%2Fconfig%2Fconstants.py&search=APP_VERSION%20%3D%20%22(%5B%5E%22%5D%2B)%22&replace=v%241&label=version&style=for-the-badge&color=3b82f6" alt="Version">
  </a>
  <a href="https://pypi.org/project/llm-finetuner-pro/">
    <img src="https://img.shields.io/pypi/v/llm-finetuner-pro?style=for-the-badge&logo=pypi&logoColor=white&color=8b5cf6" alt="PyPI: llm-finetuner-pro">
  </a>
  <a href="https://github.com/sponsors/Yog-Sotho" target="_blank" rel="noopener">
    <img src="https://img.shields.io/badge/Sponsor❤️-30363D.svg?logo=githubsponsors&logoColor=EA4AAA" alt="Sponsor on GitHub">
  </a>
</div>

---

## 🤔 What is this?

Imagine you could take a smart AI assistant and teach it to be an expert in *your* specific topic — your business, your writing style, your data. That's exactly what fine-tuning is.

LLM Fine-Tuner lets you do it through a simple visual interface. No programming knowledge needed. If you can use a spreadsheet and a web browser, you can fine-tune an AI model.

**What you can build:**
- 💼 A customer support bot that knows your products inside and out
- ✍️ A writing assistant that matches your exact tone and style
- 🏥 A domain expert trained on your specialised knowledge
- 🎮 A character AI with a specific personality
- 📚 A Q&A tool trained on your own documents

---

## ✨ Why people love it

- **No coding** — Everything happens through a point-and-click interface
- **Works on regular hardware** — Even a gaming laptop with 8 GB of GPU memory is enough
- **Fast** — Train a model in minutes, not days
- **Your data stays yours** — Everything runs on your own machine
- **Export anywhere** — Use your model in Ollama, LM Studio, or share it online

---

## 🖼️ Gallery

<div align="center">

### ⚡ What fine-tuning actually looks like

<img src="Images/LLM1.png" alt="Fine-tuning visualised as precision forging" width="750"/>

*Think of fine-tuning like a master craftsman shaping raw material into a precision tool. The AI already knows a lot — you're just focusing that knowledge toward exactly what you need.*

---

### 🚀 Supercharged with Unsloth

<img src="Images/unsloth.png" alt="Unsloth acceleration" width="750"/>

*LLM Fine-Tuner uses Unsloth under the hood — a turbo engine that makes training 2–5× faster and uses dramatically less memory. Even a regular gaming GPU becomes a fine-tuning powerhouse.*

---

### 🔓 Heretic Mode

<img src="Images/heretic.png" alt="Heretic Mode" width="750"/>

*Some AI models have built-in restrictions that get in the way. Heretic Mode lets you remove those restrictions with one click. Use it responsibly — with great power comes great responsibility.*

</div>

---

## 🚀 Get Started in 2 Minutes

### The Easy Way (recommended)

```bash
# Download the project
git clone https://github.com/Yog-Sotho/LLM-fine-tuner.git
cd LLM-fine-tuner

# Run the installer — it handles everything for you
chmod +x install.sh && ./install.sh
```

The installer will ask you a few yes/no questions. When it's done, launch with:

```bash
source llm_finetuner_env/bin/activate
llm-finetune
```

Open <http://localhost:7860> in your browser. You're ready to train.

### Want to skip all the questions?

```bash
./install.sh --yes
```

### Just want to try it quickly?

```bash
pip install -r requirements.txt
python main.py
```

> **Using Google Colab?** You can run this entirely in your browser with a free GPU. See the [full installation guide](docs/01_installation.md).

---

## 📋 How it works — step by step

### Step 1 — Prepare your data

Create a simple spreadsheet (CSV file) with two columns:

| instruction | output |
|---|---|
| What are your opening hours? | We're open Monday to Saturday, 9am to 6pm. |
| Do you offer refunds? | Yes! We offer full refunds within 30 days of purchase. |
| Where are you located? | We're at 123 Main Street, downtown. |

That's it. No special formatting, no coding. Just questions and the answers you want the model to give.

> Don't have a CSV? The tool also accepts PDFs, Excel files, JSON, plain text files, and more — or it can
> **write the questions and answers for you from your documents** (PDF, Word, text) with an AI model.

### Step 2 — Upload and train

1. Open the app (it runs in your browser)
2. Click **📂 Data** and upload your file
3. Click **🚀 Training**, pick a preset, and hit **▶ Start Training**
4. Watch the progress bar — training takes minutes to an hour depending on your hardware

### Step 3 — Test and export

1. Go to **💬 Inference** and type a question
2. Your model responds using everything it learned from your data
3. When happy, go to **📤 Share** to download or publish your model

---

## 📂 What data formats does it accept?

| Format | How to create it |
|---|---|
| CSV | Save any spreadsheet as CSV from Excel or Google Sheets |
| Excel (.xlsx) | Drag in your Excel file directly |
| JSON / JSONL | Export from your database or app |
| Plain text (.txt) | One example per line |
| PDF | Any PDF document — text is extracted automatically |

---

## 🎛️ Training Options (Plain English)

You don't need to understand all of these to get started — the defaults work great. But here's what they mean if you're curious:

| Option | What it does | Beginner recommendation |
|---|---|---|
| **Training Preset** | Quick = fast test, Balanced = good results, Accurate = best quality | Start with **Balanced** |
| **Base Model** | The starting AI brain you're teaching | Leave on **Auto** — the tool picks the right one for your hardware |
| **PEFT Method** | How the training is done internally | Leave on **Auto** |
| **Unsloth** | Turbo mode — makes training much faster | Always turn **ON** if available |
| **Heretic Mode** | Removes built-in restrictions from the model | Optional — use responsibly |

---

## 📊 Supported Training Modes

| Mode | What it does | When to use it |
|---|---|---|
| **Standard Training (SFT)** | Teaches the model using your question-answer examples | Starting point for almost everyone |
| **Preference Training (DPO)** | Teaches the model which answers are better vs worse | After standard training, to improve quality |
| **Reward model + GRPO** | Reinforcement learning against a scoring model or checkable answers | When you want the strongest alignment, or your task has verifiable answers |
| **ORPO** | Modern single-step alignment from ranked pairs | Faster alternative to reward + RL |
| **KTO** | Alignment from thumbs-up / thumbs-down feedback | When you have good/bad labels but no ranked pairs |
| **Distillation** | A small model learns from a larger one of the same family | When you want a big model's quality at a small model's cost |
| **Embedding models** | Teaches a search model which passages answer which questions | When your RAG / search misses the right documents |

Large models: multi-GPU presets for DDP, FSDP2, FSDP + QLoRA and DeepSpeed ZeRO-2/3
(`configs/accelerate/`), mixture-of-experts support (router kept stable, load balancing on)
and long-sequence options (activation offloading, padding-free batches) — see
[docs/10_advanced.md](docs/10_advanced.md).

---

## 📤 Export Options

Once trained, your model can be:

- **Downloaded as a ZIP** — keep a backup on your computer
- **Published to HuggingFace Hub** — share it with the world (or keep it private)
- **Exported as GGUF** — run it offline with [Ollama](https://ollama.ai) or [LM Studio](https://lmstudio.ai) on any computer, even without internet
- **Served with vLLM** — high-speed serving for multiple users at once

---

## 🗺️ What's been built, what's coming

**Already available:**
- ✅ Visual interface — no coding needed
- ✅ All major training modes (SFT, DPO, RLHF, ORPO)
- ✅ GGUF export for Ollama & LM Studio
- ✅ Heretic Mode
- ✅ Command-line mode for power users
- ✅ Batch evaluation tools
- ✅ Data augmentation
- ✅ Training data from your documents — an AI model writes and rates the questions and answers
- ✅ Docker image — one-command setup with no dependencies
- ✅ Multi-GPU training
- ✅ Vision + language models
- ✅ Embedding-model fine-tuning for search / RAG — with before/after retrieval scores

---

## 📖 Documentation

New to fine-tuning? The docs are written for non-technical users. Read them as a website at **[yog-sotho.github.io/LLM-fine-tuner](https://yog-sotho.github.io/LLM-fine-tuner/)**, or right here:

| Guide | What you'll learn |
|---|---|
| [Installation](docs/01_installation.md) | 4 ways to install, including Google Colab |
| [Quick Start](docs/02_quick_start.md) | Train your first model in 5 minutes |
| [Preparing Your Data](docs/03_data_preparation.md) | How to format your CSV, fix column names |
| [Training Guide](docs/04_training.md) | All settings explained in plain English |
| [Exporting Your Model](docs/08_export_and_deploy.md) | Download, publish, or deploy |
| [Troubleshooting](docs/11_troubleshooting.md) | Fix the most common errors |
| [FAQ](docs/12_faq.md) | Quick answers to common questions |

---

## 🤝 Contributing

Contributions welcome! Fork the repo, make your changes, and open a pull request with a clear description of what you did and why.

Found a bug? [Open an issue](https://github.com/Yog-Sotho/LLM-fine-tuner/issues) with your OS, GPU model, and the full error message.

---

## 📜 License

GPL-3.0 — free to use, modify, and share. Attribution appreciated ❤️

---

<div align="center">

**Made with ❤️ for the open-source community**

*If this tool helped you build something cool, a ⭐ on GitHub means the world.*
Yog-Sotho
</div>
