# AmkyawDev-LLM-V3 Burmese Language Model Fine-tuning Project using LoRA/QLoRA with Unsloth
Amkyaw AI Logo # ๐Ÿ‡ฒ๐Ÿ‡ฒ 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