# AmkyawDev-LLM-V3
Burmese Language Model Fine-tuning Project using LoRA/QLoRA with Unsloth

# ๐ฒ๐ฒ AmkyawDev-LLM-V3
### Burmese Language Model | Qwen2.5-1.5B | Unsloth Fine-tuned
**Model**: [HuggingFace](https://huggingface.co/amkyawdev/AmkyawDev-LLM-V3) | **Space**: [Gradio](https://huggingface.co/spaces/amkyawdev/AmkyawDev-LLM-V3)
*Drive Progress With Intelligent Systems*
---
## ๐ Table of Contents
- [Project Structure](#project-structure)
- [Quick Start](#quick-start)
- [Model Details](#model-details)
- [Training](#training)
- [Deployment](#deployment)
- [API Usage](#api-usage)
- [Limitations](#limitations)
- [License](#license)
- [Acknowledgments](#acknowledgments)
---
## ๐ Project Structure
```
AmkyawDev-LLM-V3/
โโโ ๐ data/ # Dataset แแญแฏแแบแธ
โ โโโ raw/ # แแแผแฏแแผแแบแแแฑแธแแฑแฌ data แแปแฌแธ (Wiki, Social, Books)
โ โโโ processed/ # Clean แแฏแแบแแผแฎแธแแฌแธ (Unicode normalized)
โ โโโ chat_format/ # ShareGPT แแญแฏแทแแแฏแแบ Alpaca format
โโโ ๐ training/ # Training scripts แแปแฌแธ
โ โโโ config.yaml # LoRA/QLoRA hyperparameters
โ โโโ train_lora.py # Standard PEFT training
โ โโโ train_unsloth.py # Unsloth memory-efficient training
โ โโโ requirements.txt # Dependencies
โโโ ๐ model/ # Output แแญแฏแแบแธ
โ โโโ adapter/ # Trained LoRA weights
โ โโโ merged/ # Base + LoRA merged version
โโโ ๐ deployment/ # API แแพแแทแบ UI แแญแฏแแบแธ
โ โโโ ๐ api/ # FastAPI แแญแฏแทแแแฏแแบ LiteLLM Proxy
โ โโโ ๐ web_ui/ # Gradio Chat Interface
โโโ ๐ scripts/ # Utility scripts
โ โโโ convert_to_unicode.py
โ โโโ push_to_hub.py # Push to HuggingFace Hub
โ โโโ push_space.py # Push to HuggingFace Spaces
โโโ README.md
```
---
## ๐ Quick Start
### 1. Install Dependencies
```bash
cd training
pip install -r requirements.txt
```
### 2. Prepare Data
```bash
# Convert raw data to normalized Unicode
python scripts/convert_to_unicode.py data/raw --output data/processed
```
### 3. Configure Training
Edit `training/config.yaml`:
```yaml
model:
name: "Qwen/Qwen2.5-1.5B-Instruct"
lora:
r: 16
lora_alpha: 32
training:
num_train_epochs: 3
learning_rate: 2e-4
bf16: true
```
### 4. Train Model
```bash
# Unsloth (Recommended - Memory Efficient)
python training/train_unsloth.py
# Standard PEFT
python training/train_lora.py
```
### 5. Deploy
```bash
# Push to HuggingFace Hub
python scripts/push_to_hub.py
# Create Gradio Space
python scripts/push_space.py
```
---
## ๐ Model Details
| Property | Value |
|----------|-------|
| **Base Model** | Qwen/Qwen2.5-1.5B-Instruct |
| **Architecture** | Transformer (Decoder-only) |
| **Training Method** | Unsloth + QLoRA (4-bit) |
| **Context Length** | 2048 tokens |
| **Parameters** | 1.5B |
| **Fine-tuning Framework** | TRL + PEFT |
### LoRA Configuration
```yaml
lora:
r: 16
lora_alpha: 32
lora_dropout: 0.05
target_modules:
- q_proj
- k_proj
- v_proj
- o_proj
- gate_proj
- up_proj
- down_proj
```
---
## ๐ง Training
### Requirements
```
torch>=2.0.0
transformers>=4.36.0
unsloth>=2024.1.0
peft>=0.8.0
trl>=0.7.0
datasets>=2.14.0
accelerate>=0.25.0
```
### Data Format (ShareGPT)
```json
{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "แแผแแบแแฌแ
แแฌแธแกแแผแฑแฌแแบแธแแซ"},
{"role": "assistant", "content": "แแฏแแบแแซแแแบแ"}
]
}
```
### Data Format (Alpaca)
```json
{
"prompt": "แแผแแบแแฌแ
แแฌแธแแแบแแซ",
"response": "แแฏแแบแแซแแแบแ"
}
```
---
## ๐ Deployment
### HuggingFace Space (Live Demo)
๐ **URL**: [https://huggingface.co/spaces/amkyawdev/AmkyawDev-LLM-V3](https://huggingface.co/spaces/amkyawdev/AmkyawDev-LLM-V3)
Features:
- ๐ฅ๏ธ Web UI Chat Interface
- โ๏ธ Adjustable Parameters (temperature, max_tokens)
- ๐ฑ Mobile-friendly
### Local Deployment
```bash
pip install gradio transformers peft
python deployment/web_ui/app.py
```
---
## ๐ก API Usage
### FastAPI
```python
from fastapi import FastAPI
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
app = FastAPI()
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B-Instruct")
tokenizer = AutoTokenizer.from_pretrained("amkyawdev/AmkyawDev-LLM-V3")
@app.post("/generate")
def generate(prompt: str):
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
return {"response": tokenizer.decode(outputs[0])}
```
---
## โ ๏ธ Limitations
1. **Knowledge Cutoff** - แแแแบแธแกแแปแแบแแแบแแปแฌแธแแแบ training data แแซแแปแญแแบแกแแญแแซแแแบแ
2. **Language Bias** - แแผแแบแแฌแแฌแแฌแ
แแฌแธแกแแฝแแบ แกแแผแแทแบแกแ
แฏแถ แแแฏแแบแแซแแแบแ
3. **Hallucination** - แแ
แบแแซแแ
แบแแฌ แแพแฌแธแแฝแแบแธแแฒแท แกแแฌแแปแฌแธแแซแแแบแ
---
## ๐ License
MIT License
Copyright (c) 2024 Amkyaw AI
---
## ๐ Acknowledgments
- [Qwen Team](https://github.com/QwenLM) - Base model
- [Unsloth AI](https://github.com/unslothai/unsloth) - Memory efficient training
- [Hugging Face](https://huggingface.co/) - Infrastructure
- [TRL](https://github.com/huggingface/trl) - SFTTrainer
- [PEFT](https://github.com/huggingface/peft) - LoRA implementation
---
### ๐ค Connect
- [GitHub](https://github.com/amkyawdev)
- [HuggingFace](https://huggingface.co/amkyawdev)
**Amkyaw AI** - Drive Progress With Intelligent Systems