Text Generation
Transformers
Safetensors
qwen2
code-generation
myanmar
burmese
qwen
qwen2.5
qwen2.5-coder
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use amkyawdev/amk-coder-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use amkyawdev/amk-coder-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="amkyawdev/amk-coder-v2") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("amkyawdev/amk-coder-v2") model = AutoModelForCausalLM.from_pretrained("amkyawdev/amk-coder-v2", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use amkyawdev/amk-coder-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "amkyawdev/amk-coder-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/amk-coder-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/amkyawdev/amk-coder-v2
- SGLang
How to use amkyawdev/amk-coder-v2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "amkyawdev/amk-coder-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/amk-coder-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "amkyawdev/amk-coder-v2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "amkyawdev/amk-coder-v2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use amkyawdev/amk-coder-v2 with Docker Model Runner:
docker model run hf.co/amkyawdev/amk-coder-v2
Add YAML metadata for model card
Browse files
README.md
CHANGED
|
@@ -1,238 +1,51 @@
|
|
| 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 |
-
| Parameter | Value |
|
| 38 |
-
| --- | --- |
|
| 39 |
-
| Precision | FP16 Mixed Precision |
|
| 40 |
-
| Optimizer | paged_adamw_8bit |
|
| 41 |
-
| Learning Rate | 3e-5 |
|
| 42 |
-
| Epochs | 3 |
|
| 43 |
-
| Batch Size | 4 per device |
|
| 44 |
-
| Gradient Accumulation | 4 steps |
|
| 45 |
-
| Max Seq Length | 2048 |
|
| 46 |
-
| Training Steps | ~2,500 |
|
| 47 |
-
| Warmup Steps | ~75 |
|
| 48 |
-
| Hardware | Kaggle (Dual NVIDIA T4 GPUs) |
|
| 49 |
-
| Training Time | ~4 hours |
|
| 50 |
-
|
| 51 |
-
## Training Metrics
|
| 52 |
-
| Metric | Value |
|
| 53 |
-
| --- | --- |
|
| 54 |
-
| Final Training Loss | 0.89 |
|
| 55 |
-
| Final Validation Loss | 0.94 |
|
| 56 |
-
| Learning Rate (final) | 2.1e-6 |
|
| 57 |
-
|
| 58 |
-
## Code Generation Examples
|
| 59 |
-
|
| 60 |
-
### Example 1: Simple Function (Myanmar Prompt)
|
| 61 |
-
**Input:**
|
| 62 |
-
```
|
| 63 |
-
<|im_start|>system
|
| 64 |
-
You are an expert Myanmar AI coding agent with tool access.<|im_end|>
|
| 65 |
-
<|im_start|>user
|
| 66 |
-
Python ဖြင့် list ထဲက largest number ကို ရှာတဲ့ function ရေးပါ<|im_end|>
|
| 67 |
-
<|im_start|>assistant
|
| 68 |
-
Thought & Code:
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
**Output:**
|
| 72 |
-
```python
|
| 73 |
-
def find_largest(numbers):
|
| 74 |
-
"""List ထဲက အကြီးဆုံးနံပါတ်ကို ရှာပါ"""
|
| 75 |
-
if not numbers:
|
| 76 |
-
return None
|
| 77 |
-
return max(numbers)
|
| 78 |
-
|
| 79 |
-
# Example
|
| 80 |
-
numbers = [10, 25, 5, 42, 17]
|
| 81 |
-
print(find_largest(numbers)) # Output: 42
|
| 82 |
-
```
|
| 83 |
-
|
| 84 |
-
### Example 2: Class Definition (English Prompt)
|
| 85 |
-
**Input:**
|
| 86 |
-
```
|
| 87 |
-
<|im_start|>system
|
| 88 |
-
You are an expert Myanmar AI coding agent with tool access.<|im_end|>
|
| 89 |
-
<|im_start|>user
|
| 90 |
-
Write a Python class for a Bank Account with deposit and withdrawal methods<|im_end|>
|
| 91 |
-
<|im_start|>assistant
|
| 92 |
-
Thought & Code:
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
**Output:**
|
| 96 |
-
```python
|
| 97 |
-
class BankAccount:
|
| 98 |
-
def __init__(self, account_holder, initial_balance=0):
|
| 99 |
-
self.account_holder = account_holder
|
| 100 |
-
self.balance = initial_balance
|
| 101 |
-
|
| 102 |
-
def deposit(self, amount):
|
| 103 |
-
if amount > 0:
|
| 104 |
-
self.balance += amount
|
| 105 |
-
return f"Deposited {amount}. New balance: {self.balance}"
|
| 106 |
-
return "Invalid deposit amount"
|
| 107 |
-
|
| 108 |
-
def withdraw(self, amount):
|
| 109 |
-
if amount > self.balance:
|
| 110 |
-
return "Insufficient funds"
|
| 111 |
-
self.balance -= amount
|
| 112 |
-
return f"Withdrew {amount}. New balance: {self.balance}"
|
| 113 |
-
|
| 114 |
-
# Example
|
| 115 |
-
account = BankAccount("Kyaw", 1000)
|
| 116 |
-
print(account.deposit(500)) # Deposited 500. New balance: 1500
|
| 117 |
-
print(account.withdraw(300)) # Withdrew 300. New balance: 1200
|
| 118 |
-
```
|
| 119 |
-
|
| 120 |
-
### Example 3: Myanmar Code Comment
|
| 121 |
-
**Input:**
|
| 122 |
-
```
|
| 123 |
-
<|im_start|>system
|
| 124 |
-
You are an expert Myanmar AI coding agent with tool access.<|im_end|>
|
| 125 |
-
<|im_start|>user
|
| 126 |
-
Fibonacci sequence generator ရေးပါ။ တွက်ချက်ပုံကို myanmar နဲ့ comment ရေးပါ<|im_end|>
|
| 127 |
-
<|im_start|>assistant
|
| 128 |
-
Thought & Code:
|
| 129 |
-
```
|
| 130 |
-
|
| 131 |
-
**Output:**
|
| 132 |
-
```python
|
| 133 |
-
def fibonacci(n):
|
| 134 |
-
"""
|
| 135 |
-
Fibonacci sequence generator
|
| 136 |
-
- F(0) = 0
|
| 137 |
-
- F(1) = 1
|
| 138 |
-
- F(n) = F(n-1) + F(n-2)
|
| 139 |
-
"""
|
| 140 |
-
a, b = 0, 1
|
| 141 |
-
for _ in range(n):
|
| 142 |
-
yield a # လက်ရှိတန်ဖိုးကို ထုတ်ပေးမယ်
|
| 143 |
-
a, b = b, a + b # နောက်တန်ဖိုးသစ်ကို တွက်ချက်မယ်
|
| 144 |
-
|
| 145 |
-
# Example
|
| 146 |
-
print(list(fibonacci(10))) # [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
| 147 |
-
```
|
| 148 |
-
|
| 149 |
-
## How to Get Started
|
| 150 |
-
|
| 151 |
-
### Using Transformers
|
| 152 |
-
```python
|
| 153 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 154 |
-
|
| 155 |
-
model_name = "amkyawdev/amk-coder-v2"
|
| 156 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 157 |
-
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 158 |
-
|
| 159 |
-
# Myanmar prompt
|
| 160 |
-
prompt = """<|im_start|>system
|
| 161 |
-
You are an expert Myanmar AI coding agent with tool access.<|im_end|>
|
| 162 |
-
<|im_start|>user
|
| 163 |
-
Python ဖြင့် hello world print လုပ်ပါ<|im_end|>
|
| 164 |
-
<|im_start|>assistant
|
| 165 |
-
Thought & Code:"""
|
| 166 |
-
|
| 167 |
-
inputs = tokenizer(prompt, return_tensors="pt")
|
| 168 |
-
outputs = model.generate(
|
| 169 |
-
**inputs,
|
| 170 |
-
max_new_tokens=256,
|
| 171 |
-
temperature=0.2,
|
| 172 |
-
do_sample=True
|
| 173 |
-
)
|
| 174 |
-
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 175 |
```
|
| 176 |
|
| 177 |
-
###
|
| 178 |
```bash
|
| 179 |
-
|
|
|
|
| 180 |
```
|
| 181 |
|
| 182 |
-
##
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
-
|
| 186 |
-
- Building Myanmar-speaking coding assistants
|
| 187 |
-
- Code translation (English ↔ Myanmar)
|
| 188 |
-
- Educational code examples in Myanmar
|
| 189 |
-
|
| 190 |
-
### Out-of-Scope Use
|
| 191 |
-
- ⚠️ Not for production deployment without testing
|
| 192 |
-
- ⚠️ Not for safety-critical applications
|
| 193 |
-
- ⚠️ Not for generating malicious code
|
| 194 |
-
- ⚠️ Always verify generated code before execution
|
| 195 |
-
|
| 196 |
-
## Safety Evaluation
|
| 197 |
-
|
| 198 |
-
### Harmful Code Detection
|
| 199 |
-
| Test Category | Result | Notes |
|
| 200 |
-
| --- | --- | --- |
|
| 201 |
-
| Malware Generation | ✅ Blocked | Model refuses malicious requests |
|
| 202 |
-
| Exploit Code | ⚠️ Partial | Some basic exploits may be generated |
|
| 203 |
-
| Injection Attacks | ✅ Blocked | SQL, XSS injection blocked |
|
| 204 |
-
| PII Extraction | ✅ Blocked | No PII extraction capability |
|
| 205 |
-
|
| 206 |
-
### Limitations
|
| 207 |
-
- May generate syntactically incorrect code
|
| 208 |
-
- Myanmar language support may be inconsistent
|
| 209 |
-
- Complex algorithms may contain errors
|
| 210 |
-
- Always review code before use
|
| 211 |
-
|
| 212 |
-
## Bias, Risks, and Limitations
|
| 213 |
-
- Model may generate incorrect or insecure code
|
| 214 |
-
- Myanmar language quality varies
|
| 215 |
-
- Training data quality affects outputs
|
| 216 |
-
- Not suitable for critical infrastructure code
|
| 217 |
-
|
| 218 |
-
## Environmental Impact
|
| 219 |
-
- **Hardware Type:** NVIDIA T4 GPUs (Dual)
|
| 220 |
-
- **Cloud Provider:** Kaggle
|
| 221 |
-
- **Training Time:** ~4 hours
|
| 222 |
-
- **Carbon Footprint:** ~0.2 kg CO2e (estimated)
|
| 223 |
-
|
| 224 |
-
## Citation
|
| 225 |
-
```bibtex
|
| 226 |
-
@misc{amk-coder-v2,
|
| 227 |
-
author = {amkyawdev},
|
| 228 |
-
title = {amk-coder-v2: Myanmar Coding Agent Model},
|
| 229 |
-
year = {2025},
|
| 230 |
-
publisher = {HuggingFace},
|
| 231 |
-
url = {https://huggingface.co/amkyawdev/amk-coder-v2}
|
| 232 |
-
}
|
| 233 |
-
```
|
| 234 |
|
| 235 |
-
##
|
| 236 |
-
-
|
| 237 |
-
- Training Framework: [Unsloth](https://github.com/unslothai/unsloth), Hugging Face TRL
|
| 238 |
-
- Dataset: [amkyawdev/mm-llm-coder-agent-dataset](https://huggingface.co/datasets/amkyawdev/mm-llm-coder-agent-dataset)
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: text-generation
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- code-generation
|
| 6 |
+
- myanmar
|
| 7 |
+
- burmese
|
| 8 |
+
- qwen
|
| 9 |
+
- conversational
|
| 10 |
+
- transformers
|
| 11 |
+
library_name: transformers
|
| 12 |
+
inference:
|
| 13 |
+
parameters:
|
| 14 |
+
max_new_tokens: 512
|
| 15 |
+
temperature: 0.2
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# 🤖 amk-coder-agent
|
| 19 |
+
|
| 20 |
+
Myanmar Coding Agent using **amk-coder-v2** (fine-tuned from Qwen2.5-Coder-1.5B)
|
| 21 |
+
|
| 22 |
+
## Features
|
| 23 |
+
- 🇲🇲 Myanmar & English language support
|
| 24 |
+
- 💻 Code generation, debugging, explanation
|
| 25 |
+
- 🔍 Web search integration
|
| 26 |
+
- 🌐 Streaming responses
|
| 27 |
+
- 🎨 Beautiful chat UI
|
| 28 |
+
|
| 29 |
+
## Quick Start
|
| 30 |
+
|
| 31 |
+
### Backend
|
| 32 |
+
```bash
|
| 33 |
+
cd backend
|
| 34 |
+
pip install -r requirements.txt
|
| 35 |
+
export HF_TOKEN=hf_your_token
|
| 36 |
+
uvicorn app.main:app --host 0.0.0.0 --port 8000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
+
## License
|
| 51 |
+
Apache-2.0
|
|
|
|
|
|