File size: 2,341 Bytes
59d6954
 
 
 
 
 
 
 
 
b971b43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59d6954
 
b971b43
59d6954
b971b43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59d6954
 
 
b971b43
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
base_model: unsloth/qwen2.5-coder-14b-instruct-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- qwen2
license: apache-2.0
language:
- zho
- eng
- fra
- spa
- por
- deu
- ita
- rus
- jpn
- kor
- vie
- tha
- ara
datasets:
- nvidia/OpenCodeReasoning
---

# Qwen2.5_Coder_14B_CodingModel

**Developer:** `kamranrafi`
**Base model:** `Qwen/Qwen2.5-Coder-14B-Instruct`
**Objective:** Codegeneration with explanations.
**License:** Apache-2.0
**Dataset:** [`nvidia/OpenCodeReasoning`](https://huggingface.co/datasets/nvidia/OpenCodeReasoning)

## Quick Inference

### Transformers (PyTorch)

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "kamranrafi/Qwen2.5_Coder_14B_CodingModel"
tok = AutoTokenizer.from_pretrained(model_id, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.float16,
    device_map="cuda:1"
)

def chat(user_msg, max_new_tokens=512, temperature=0.2, top_p=0.9):
    msgs = [
        {"role":"system","content": "You are Qwen2.5 Coder 14B Coding Model, a smart coding assistant.\n"},
        {"role":"user","content": user_msg},
    ]
    prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
    inputs = tok(prompt, return_tensors="pt").to(model.device)
    out = model.generate(
        **inputs,
        max_new_tokens=max_new_tokens,
        temperature=temperature,
        top_p=top_p,
        do_sample=temperature > 0
    )
    text = tok.decode(out[0], skip_special_tokens=True)
    # Optional: trim everything before the assistant turn
    return text.split("<|im_start|>assistant")[-1].strip()

print(chat("Create a function to return sorted list."))
```

## 🧾 Citation

If you use this model, please cite:

```
@misc{
  title  = {Qwen2.5_Coder_14B_CodingModel},
  author = {Muhammad Kamran Rafi},
  year   = {2025},
  howpublished = {\url{https://huggingface.co/kamranrafi/Qwen2.5_Coder_14B_CodingModel}},
  note   = {Fine-tuned with Unsloth on nvidia/OpenCodeReasoning}
}
```

This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.

[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)