Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
code-generation
math-reasoning
qwen3.5
lora
sft
conversational
Instructions to use Natarizki/CMLM-0.8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Natarizki/CMLM-0.8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Natarizki/CMLM-0.8B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Natarizki/CMLM-0.8B") model = AutoModelForMultimodalLM.from_pretrained("Natarizki/CMLM-0.8B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Natarizki/CMLM-0.8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Natarizki/CMLM-0.8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Natarizki/CMLM-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Natarizki/CMLM-0.8B
- SGLang
How to use Natarizki/CMLM-0.8B 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 "Natarizki/CMLM-0.8B" \ --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": "Natarizki/CMLM-0.8B", "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 "Natarizki/CMLM-0.8B" \ --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": "Natarizki/CMLM-0.8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Natarizki/CMLM-0.8B with Docker Model Runner:
docker model run hf.co/Natarizki/CMLM-0.8B
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: unsloth/Qwen3.5-0.8B
|
| 4 |
+
tags:
|
| 5 |
+
- code-generation
|
| 6 |
+
- math-reasoning
|
| 7 |
+
- qwen3.5
|
| 8 |
+
- lora
|
| 9 |
+
- sft
|
| 10 |
+
datasets:
|
| 11 |
+
- ise-uiuc/Magicoder-Evol-Instruct-110K
|
| 12 |
+
- meta-math/MetaMathQA
|
| 13 |
+
- AI-MO/NuminaMath-CoT
|
| 14 |
+
library_name: transformers
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# CMLM-0.8B
|
| 19 |
+
|
| 20 |
+
**C**oding + **M**ath **L**anguage **M**odel — a Qwen3.5-0.8B fine-tuned for code generation and mathematical reasoning.
|
| 21 |
+
|
| 22 |
+
## Model Details
|
| 23 |
+
|
| 24 |
+
| Property | Value |
|
| 25 |
+
| :--- | :--- |
|
| 26 |
+
| Base Model | [unsloth/Qwen3.5-0.8B](https://huggingface.co/unsloth/Qwen3.5-0.8B) |
|
| 27 |
+
| Architecture | Qwen3.5 (Gated DeltaNet + Full Attention hybrid) |
|
| 28 |
+
| Parameters | 0.8B |
|
| 29 |
+
| Training Method | LoRA (r=16, α=32) |
|
| 30 |
+
| Precision | float32 (no quantization) |
|
| 31 |
+
| Max Context | 2048 tokens |
|
| 32 |
+
| Framework | Unsloth + TRL SFTTrainer |
|
| 33 |
+
| Hardware | NVIDIA Tesla T4 (16 GB VRAM) |
|
| 34 |
+
|
| 35 |
+
## Training Data
|
| 36 |
+
|
| 37 |
+
| Dataset | Samples | Domain |
|
| 38 |
+
| :--- | :--- | :--- |
|
| 39 |
+
| [Magicoder-Evol-Instruct-110K](https://huggingface.co/datasets/ise-uiuc/Magicoder-Evol-Instruct-110K) | 25,000 | Code instruction following |
|
| 40 |
+
| [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA) | 25,000 | Mathematical reasoning |
|
| 41 |
+
| [NuminaMath-CoT](https://huggingface.co/datasets/AI-MO/NuminaMath-CoT) | 15,000 | Math chain-of-thought |
|
| 42 |
+
| **Total** | **65,000** | |
|
| 43 |
+
|
| 44 |
+
## Training Hyperparameters
|
| 45 |
+
|
| 46 |
+
```yaml
|
| 47 |
+
learning_rate: 2e-4
|
| 48 |
+
max_steps: 500
|
| 49 |
+
per_device_train_batch_size: 2
|
| 50 |
+
gradient_accumulation_steps: 8
|
| 51 |
+
effective_batch_size: 16
|
| 52 |
+
warmup_steps: 100
|
| 53 |
+
optimizer: adamw_8bit
|
| 54 |
+
gradient_checkpointing: unsloth
|
| 55 |
+
lora_r: 16
|
| 56 |
+
lora_alpha: 32
|
| 57 |
+
lora_dropout: 0
|
| 58 |
+
target_modules: [q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]
|
| 59 |
+
packing: true
|
| 60 |
+
max_seq_length: 2048
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Usage
|
| 64 |
+
|
| 65 |
+
```python
|
| 66 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 67 |
+
|
| 68 |
+
model = AutoModelForCausalLM.from_pretrained("Natarizki/CMLM-0.8B", device_map="auto")
|
| 69 |
+
tokenizer = AutoTokenizer.from_pretrained("Natarizki/CMLM-0.8B")
|
| 70 |
+
|
| 71 |
+
messages = [{"role": "user", "content": "Write a Python function to check if a number is prime."}]
|
| 72 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 73 |
+
|
| 74 |
+
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
|
| 75 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
## Benchmarks
|
| 79 |
+
|
| 80 |
+
| Domain | CMLM-0.8B (tok/s) | Base Qwen3.5-0.8B (tok/s) | Avg Latency (CMLM) |
|
| 81 |
+
| :--- | :--- | :--- | :--- |
|
| 82 |
+
| Coding | 12.1 | 15.2 | 39.0s |
|
| 83 |
+
| Math | 14.8 | 15.1 | 15.9s |
|
| 84 |
+
| General | 15.0 | 15.1 | 17.0s |
|
| 85 |
+
|
| 86 |
+
> **Note:** CMLM generates longer, more detailed responses for coding tasks (hence lower tok/s but higher quality). Math and general domains show near-parity with base model throughput. Benchmarked on NVIDIA T4 with float32 inference via Unsloth.
|
| 87 |
+
|
| 88 |
+
## Limitations
|
| 89 |
+
|
| 90 |
+
- Trained on 65K samples; may underperform on niche domains
|
| 91 |
+
- 2048 token context limit; not suitable for long-document tasks
|
| 92 |
+
- float32 training preserves accuracy but increases inference memory vs. quantized variants
|
| 93 |
+
- No vision capabilities despite Qwen3.5's native multimodal architecture
|
| 94 |
+
|
| 95 |
+
## License
|
| 96 |
+
|
| 97 |
+
Apache 2.0 (inherits from Qwen3.5)
|
| 98 |
+
|
| 99 |
+
## Acknowledgments
|
| 100 |
+
|
| 101 |
+
- [Qwen Team](https://huggingface.co/Qwen) for the base model
|
| 102 |
+
- [Unsloth](https://unsloth.ai/) for efficient T4-compatible training
|
| 103 |
+
- Dataset authors: Magicoder, MetaMath, NuminaMath teams
|