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
| pipeline_tag: text-generation | |
| license: apache-2.0 | |
| tags: | |
| - code-generation | |
| - myanmar | |
| - burmese | |
| - qwen | |
| - qwen2 | |
| - qwen2.5 | |
| - qwen2.5-coder | |
| - transformers | |
| - conversational | |
| - text-generation | |
| library_name: transformers | |
| inference: | |
| parameters: | |
| max_new_tokens: 512 | |
| temperature: 0.2 | |
| top_p: 0.95 | |
| repetition_penalty: 1.1 | |
| model-index: | |
| - name: amk-coder-v2 | |
| results: | |
| - task: | |
| type: text-generation | |
| name: Code Generation | |
| dataset: | |
| name: HumanEval | |
| type: openai/openai_humaneval | |
| metrics: | |
| - type: pass_at_1 | |
| value: 50.0 | |
| verified: false | |
| - type: pass_at_10 | |
| value: 75.0 | |
| verified: false | |
| - task: | |
| type: text-generation | |
| name: Python Code Generation | |
| dataset: | |
| name: MBPP | |
| type: abdshhayan/MBPP | |
| metrics: | |
| - type: pass_at_1 | |
| value: 55.0 | |
| verified: false | |
| # π€ amk-coder-v2 | |
| Myanmar Coding Assistant - Fine-tuned from **Qwen2.5-Coder-1.5B** | |
| [](https://huggingface.co/amkyawdev/amk-coder-v2) | |
| [](LICENSE) | |
| [](https://huggingface.co/amkyawdev/amk-coder-v2) | |
| --- | |
| ## π Table of Contents | |
| - [Features](#-features) | |
| - [Model Details](#-model-details) | |
| - [Quick Start](#-quick-start) | |
| - [Usage Examples](#-usage-examples) | |
| - [API Endpoints](#-api-endpoints) | |
| - [Deployment](#-deployment) | |
| - [Limitations](#-limitations) | |
| - [License](#-license) | |
| --- | |
| ## β¨ Features | |
| | Feature | Description | | |
| |---------|-------------| | |
| | π²π² **Myanmar Support** | Full support for Myanmar Unicode text | | |
| | π» **Code Generation** | Python, JavaScript, C++, Java, and more | | |
| | π **Debugging** | Bug detection and fixes | | |
| | π **Code Explanation** | Line-by-line explanations | | |
| | π **Web Search** | Integration for latest documentation | | |
| | π **Streaming** | Real-time response streaming | | |
| | π¨ **Beautiful UI** | Modern chat interface | | |
| --- | |
| ## π Model Details | |
| | Attribute | Value | | |
| |-----------|-------| | |
| | **Base Model** | Qwen2.5-Coder-1.5B | | |
| | **Parameters** | 2B (2,000M) | | |
| | **Architecture** | Qwen2ForCausalLM | | |
| | **Hidden Size** | 1536 | | |
| | **Layers** | 28 | | |
| | **Attention Heads** | 12 | | |
| | **Vocab Size** | 151,936 | | |
| | **Context Length** | 32,768 tokens | | |
| | **Tensor Type** | BF16 | | |
| | **Format** | Safetensors | | |
| | **License** | Apache-2.0 | | |
| ### Training Details | |
| | Parameter | Value | | |
| |-----------|-------| | |
| | **Framework** | Transformers + PEFT | | |
| | **Training Method** | LoRA fine-tuning | | |
| | **Learning Rate** | 2e-4 | | |
| | **Epochs** | 3 | | |
| | **Batch Size** | 8 | | |
| | **Max Length** | 2048 | | |
| --- | |
| ## π Quick Start | |
| ### Using Transformers (Python) | |
| ```python | |
| # Method 1: Pipeline (Recommended for beginners) | |
| from transformers import pipeline | |
| pipe = pipeline("text-generation", model="amkyawdev/amk-coder-v2") | |
| messages = [ | |
| {"role": "user", "content": "Python αα²α· list comprehension αα±αΈαα«"} | |
| ] | |
| result = pipe(messages, max_new_tokens=512, temperature=0.2) | |
| print(result[0]['generated_text']) | |
| # Method 2: Direct Model Loading | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| import torch | |
| tokenizer = AutoTokenizer.from_pretrained("amkyawdev/amk-coder-v2") | |
| model = AutoModelForCausalLM.from_pretrained( | |
| "amkyawdev/amk-coder-v2", | |
| torch_dtype=torch.bfloat16, | |
| device_map="auto" | |
| ) | |
| messages = [ | |
| {"role": "system", "content": "You are a helpful coding assistant."}, | |
| {"role": "user", "content": "Write a Python function to reverse a string"} | |
| ] | |
| inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device) | |
| outputs = model.generate(inputs, max_new_tokens=512, temperature=0.2) | |
| response = tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True) | |
| print(response) | |
| ``` | |
| ### Using vLLM (Production) | |
| ```bash | |
| # Install vLLM | |
| pip install vllm | |
| # Start server | |
| vllm serve "amkyawdev/amk-coder-v2" --tensor-parallel-size 1 | |
| # API call | |
| curl -X POST "http://localhost:8000/v1/chat/completions" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "amkyawdev/amk-coder-v2", | |
| "messages": [ | |
| {"role": "user", "content": "Hello, write Python code"} | |
| ], | |
| "max_tokens": 512, | |
| "temperature": 0.2 | |
| }' | |
| ``` | |
| ### Using SGLang | |
| ```bash | |
| # Install SGLang | |
| pip install sglang | |
| # Start server | |
| python -m sglang.launch_server --model-path "amkyawdev/amk-coder-v2" --port 30000 | |
| # API call | |
| curl -X POST "http://localhost:30000/v1/chat/completions" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "amkyawdev/amk-coder-v2", | |
| "messages": [{"role": "user", "content": "Write a hello world in Python"}] | |
| }' | |
| ``` | |
| --- | |
| ## π‘ Usage Examples | |
| ### π²π² Myanmar Prompts | |
| ```python | |
| # Code generation in Myanmar | |
| messages = [ | |
| {"role": "user", "content": "Python function αα αΊαα―αα±αΈαα«α ααααΊαΈαα½α±ααα― sorting αα―ααΊαα±αΈαα«α"} | |
| ] | |
| # Output: def sort_numbers(numbers): return sorted(numbers) | |
| ``` | |
| ### π¬π§ English Prompts | |
| ```python | |
| messages = [ | |
| {"role": "user", "content": "Explain this code:\nfor i in range(10):\n print(i)"} | |
| ] | |
| # Output: This is a for loop that prints numbers 0 to 9 | |
| ``` | |
| ### π Debugging | |
| ```python | |
| messages = [ | |
| {"role": "user", "content": "Fix this Python code:\nprint('Hello' + 5)"} | |
| ] | |
| # Output: TypeError fix suggestion with corrected code | |
| ``` | |
| --- | |
| ## π API Endpoints | |
| ### Backend Server | |
| ```bash | |
| cd backend | |
| pip install -r requirements.txt | |
| export HF_TOKEN=hf_your_token | |
| uvicorn app.main:app --host 0.0.0.0 --port 8000 | |
| ``` | |
| ### Endpoints | |
| | Method | Endpoint | Description | | |
| |--------|----------|-------------| | |
| | GET | `/` | Health check | | |
| | GET | `/health` | Service health status | | |
| | POST | `/chat` | Streaming chat (SSE) | | |
| | GET | `/demo` | Demo HTML interface | | |
| | GET | `/models` | Model information | | |
| ### Request Format | |
| ```bash | |
| # Streaming chat | |
| curl -X POST "http://localhost:8000/chat" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "messages": [ | |
| {"role": "user", "content": "Write a Fibonacci function in Python"} | |
| ], | |
| "stream": true | |
| }' | |
| ``` | |
| --- | |
| ## π³ Deployment | |
| ### Docker | |
| ```bash | |
| # Using Docker Model Runner | |
| docker model run hf.co/amkyawdev/amk-coder-v2 | |
| # Using vLLM Docker | |
| docker run --gpus all \ | |
| -v ~/.cache/huggingface:/root/.cache/huggingface \ | |
| -p 8000:8000 \ | |
| --rm \ | |
| vllm/vllm-openai:latest \ | |
| --model amkyawdev/amk-coder-v2 | |
| ``` | |
| ### Google Colab | |
| [](https://colab.research.google.com/github/amkyawdev/amk-coder-v2) | |
| ### Kaggle | |
| [](https://www.kaggle.com) | |
| --- | |
| ## β οΈ Limitations | |
| 1. **Context Length** - Maximum 32,768 tokens | |
| 2. **Code Quality** - May generate incorrect code; verify outputs | |
| 3. **Myanmar Unicode** - Best results with proper Zawgyi-to-Unicode conversion | |
| 4. **Domain Knowledge** - Limited to common programming languages | |
| 5. **Safety** - May produce harmful content; use responsible AI practices | |
| --- | |
| ## π Resources | |
| - [Qwen2.5-Coder Documentation](https://qwenlm.github.io/blog/Qwen2.5-Coder/) | |
| - [Transformers Library](https://huggingface.co/docs/transformers) | |
| - [HuggingFace Hub](https://huggingface.co/docs/hub) | |
| --- | |
| ## π Acknowledgments | |
| - **Alibaba Cloud Qwen Team** - Base model Qwen2.5-Coder | |
| - **HuggingFace** - Model hosting and infrastructure | |
| - **Myanmar Developer Community** - Testing and feedback | |
| --- | |
| ## π License | |
| Apache License 2.0 - See [LICENSE](LICENSE) file for details. | |
| --- | |
| ## π§ Contact | |
| - **Author**: amkyawdev | |
| - **HuggingFace**: [amkyawdev/amk-coder-v2](https://huggingface.co/amkyawdev/amk-coder-v2) | |
| - **GitHub**: [github.com/amkyawdev](https://github.com/amkyawdev) | |
| --- | |
| *Made with β€οΈ for Myanmar Developers* | |