amkyawdev commited on
Commit
2fc8ea6
·
verified ·
1 Parent(s): df2fd27

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +169 -69
README.md CHANGED
@@ -1,81 +1,154 @@
1
- ---
2
- license: apache-2.0
3
- pipeline_tag: text-generation
4
- tags:
5
- - code
6
- - qwen
7
- - generated_from_trainer
8
- - myanmar-nlp
9
- - ai-agent
10
- library_name: transformers
11
- base_model: Qwen/Qwen2.5-Coder-1.5B
12
- datasets:
13
- - amkyawdev/mm-llm-coder-agent-dataset
14
- language:
15
- - my
16
- - en
17
- metrics:
18
- - accuracy
19
- ---
20
- # Model Card for amk-coder-v2
21
 
22
  ## Model Details
23
-
24
- ### Model Description
25
- Myanmar-localized coding agent model fine-tuned from Qwen/Qwen2.5-Coder-1.5B using LoRA (PEFT). Designed for code generation and coding assistance in Myanmar language context.
26
-
27
  - **Developed by:** amkyawdev
28
- - **Model type:** Language Model (LLM)
29
- - **Language(s) (NLP):** Myanmar (my), English (en)
30
  - **License:** Apache-2.0
31
- - **Finetuned from model:** Qwen/Qwen2.5-Coder-1.5B
 
 
32
 
33
- ### Model Sources
 
 
 
34
  - **Repository:** [amkyawdev/amk-coder-v2](https://huggingface.co/amkyawdev/amk-coder-v2)
35
  - **Dataset:** [amkyawdev/mm-llm-coder-agent-dataset](https://huggingface.co/datasets/amkyawdev/mm-llm-coder-agent-dataset)
 
36
 
37
  ## Model Configuration
38
-
39
  | Parameter | Value |
40
- |-----------|-------|
41
  | Base Model | Qwen/Qwen2.5-Coder-1.5B |
42
  | Fine-tuning Method | LoRA (PEFT) |
43
  | Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
 
 
 
44
  | Optimizer | paged_adamw_8bit |
45
  | Precision | FP16 Mixed Precision |
46
  | Learning Rate | 3e-5 |
47
- | Training Infrastructure | Kaggle Cloud (Dual NVIDIA T4 GPUs) |
 
 
48
 
49
- ## Chat Template
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
- This model uses the ChatML structure:
 
 
 
 
 
 
 
 
 
 
 
52
 
53
- ```xml
 
 
54
  <|im_start|>system
55
  You are an expert Myanmar AI coding agent with tool access.<|im_end|>
56
  <|im_start|>user
57
- {Instruction}
58
- Tools available: {Tools}<|im_end|>
59
  <|im_start|>assistant
60
  Thought & Code:
61
  ```
62
 
63
- ## Training Details
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
- ### Training Data
66
- - **Dataset:** amkyawdev/mm-llm-coder-agent-dataset
67
- - **Description:** Myanmar localized coding agent dataset for instruction-tuned code generation
 
 
 
 
 
 
 
68
 
69
- ### Training Hyperparameters
70
- | Parameter | Value |
71
- |-----------|-------|
72
- | Precision | FP16 Mixed Precision |
73
- | Optimizer | paged_adamw_8bit |
74
- | Learning Rate | 3e-5 |
75
- | Hardware | Kaggle Cloud (Dual NVIDIA T4 GPUs) |
 
 
 
 
 
 
 
 
 
 
76
 
77
- ## How to Get Started with the Model
78
 
 
79
  ```python
80
  from transformers import AutoModelForCausalLM, AutoTokenizer
81
 
@@ -83,47 +156,73 @@ model_name = "amkyawdev/amk-coder-v2"
83
  tokenizer = AutoTokenizer.from_pretrained(model_name)
84
  model = AutoModelForCausalLM.from_pretrained(model_name)
85
 
86
- # Chat prompt format
87
  prompt = """<|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 function to add two numbers
91
- Tools available: python<|im_end|>
92
  <|im_start|>assistant
93
- Thought & Code:
94
- """
95
 
96
  inputs = tokenizer(prompt, return_tensors="pt")
97
- outputs = model.generate(**inputs, max_new_tokens=512)
 
 
 
 
 
98
  print(tokenizer.decode(outputs[0], skip_special_tokens=True))
99
  ```
100
 
 
 
 
 
 
101
  ## Uses
102
 
103
  ### Direct Use
104
- This model can be used for code generation tasks with Myanmar language instructions. Suitable for building coding assistants that understand Burmese/Myanmar language prompts.
 
 
 
105
 
106
  ### Out-of-Scope Use
107
- - Not intended for production deployment without fine-tuning
108
- - Not tested for safety-critical applications
109
- - May generate incorrect code; always verify outputs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  ## Bias, Risks, and Limitations
112
- - Model may generate syntactically incorrect code
113
- - May not follow security best practices
114
- - Training data quality affects output quality
115
- - Myanmar language support may be limited compared to English
116
 
117
  ## Environmental Impact
118
  - **Hardware Type:** NVIDIA T4 GPUs (Dual)
119
  - **Cloud Provider:** Kaggle
120
- - **Training Time:** ~3-5 hours
 
121
 
122
  ## Citation
123
-
124
- If you use this model, please cite:
125
-
126
- ```
127
  @misc{amk-coder-v2,
128
  author = {amkyawdev},
129
  title = {amk-coder-v2: Myanmar Coding Agent Model},
@@ -133,6 +232,7 @@ If you use this model, please cite:
133
  }
134
  ```
135
 
136
- ## More Information
137
- - Dataset: [amkyawdev/mm-llm-coder-agent-dataset](https://huggingface.co/datasets/amkyawdev/mm-llm-coder-agent-dataset)
138
  - Base Model: [Qwen/Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B)
 
 
 
1
+ # Model Card: amk-coder-v2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  ## Model Details
 
 
 
 
4
  - **Developed by:** amkyawdev
5
+ - **Model type:** Language Model (LLM) - Code Generation
6
+ - **Language(s):** Myanmar (my), English (en)
7
  - **License:** Apache-2.0
8
+ - **Base Model:** Qwen/Qwen2.5-Coder-1.5B
9
+ - **Model Size:** 2B parameters
10
+ - **Released:** 2025
11
 
12
+ ## Model Description
13
+ Myanmar-localized coding agent model fine-tuned from Qwen/Qwen2.5-Coder-1.5B using LoRA (PEFT). Designed for code generation and coding assistance in Myanmar language context.
14
+
15
+ ## Model Sources
16
  - **Repository:** [amkyawdev/amk-coder-v2](https://huggingface.co/amkyawdev/amk-coder-v2)
17
  - **Dataset:** [amkyawdev/mm-llm-coder-agent-dataset](https://huggingface.co/datasets/amkyawdev/mm-llm-coder-agent-dataset)
18
+ - **Space Demo:** [amkyawdev/amkyawdev-amk-coder-v2](https://huggingface.co/spaces/amkyawdev/amkyawdev-amk-coder-v2)
19
 
20
  ## Model Configuration
 
21
  | Parameter | Value |
22
+ | --- | --- |
23
  | Base Model | Qwen/Qwen2.5-Coder-1.5B |
24
  | Fine-tuning Method | LoRA (PEFT) |
25
  | Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
26
+ | LoRA Rank (r) | 16 |
27
+ | LoRA Alpha | 32 |
28
+ | LoRA Dropout | 0.05 |
29
  | Optimizer | paged_adamw_8bit |
30
  | Precision | FP16 Mixed Precision |
31
  | Learning Rate | 3e-5 |
32
+ | Weight Decay | 0.01 |
33
+ | Warmup Ratio | 0.03 |
34
+ | Hardware | Kaggle Cloud (Dual NVIDIA T4 GPUs) |
35
 
36
+ ## Training Details
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
 
 
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
+ ### Using vLLM (Production)
178
+ ```bash
179
+ vllm serve "amkyawdev/amk-coder-v2"
180
+ ```
181
+
182
  ## Uses
183
 
184
  ### Direct Use
185
+ - Code generation with Myanmar language instructions
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},
 
232
  }
233
  ```
234
 
235
+ ## Acknowledgments
 
236
  - Base Model: [Qwen/Qwen2.5-Coder-1.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B)
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)