File size: 7,291 Bytes
c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 78fb48b f748564 939ee59 f748564 939ee59 f748564 939ee59 f748564 939ee59 f748564 939ee59 f748564 939ee59 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 c7a1f78 f748564 |
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
---
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
base_model_relation: finetune
library_name: peft
language:
- en
tags:
- code
- codeqwen
- chat
- qwen
- qwen-coder
license: gpl-3.0
datasets:
- nvidia/OpenCodeReasoning
pipeline_tag: text-generation
license_link: https://huggingface.co/bunyaminergen/Qwen2.5-Coder-1.5B-Instruct-Reasoning/blob/main/LICENSE
---
# Qwen2.5-Coder-1.5B-Instruct-Reasoning
The `Qwen2.5-Coder-1.5B-Instruct-Reasoning` model has been supervised fine-tuned (SFT) on the `nvidia/OpenCodeReasoning`
dataset to enhance its reasoning capabilities.
---
### TableofContents
- [Usage](#usage)
- [Dataset](#dataset)
- [Training](#training)
- [License](#licence)
- [Links](#links)
- [Team](#team)
- [Contact](#contact)
- [Reference](#reference)
- [Citation](#citation)
---
### Usage
#### Hugging Face
```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model_name = "Qwen/Qwen2.5-Coder-1.5B-Instruct"
adapter_repo = "bunyaminergen/Qwen2.5-Coder-1.5B-Instruct-Reasoning"
tokenizer = AutoTokenizer.from_pretrained(adapter_repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base_model_name,
device_map="auto",
torch_dtype="auto",
)
model.resize_token_embeddings(len(tokenizer))
model = PeftModel.from_pretrained(model, adapter_repo)
model.eval()
messages = [
{"role": "system", "content": "You are a helpful coding assistant."},
{"role": "user", "content": "write a quick sort algorithm."}
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=2048
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
---
### Dataset
- [nvidia/OpenCodeReasoning](https://huggingface.co/datasets/nvidia/OpenCodeReasoning)
---
### Training
#### Base
| Parameter | Value |
|-----------------------------|------------------------------------|
| Base Model | `Qwen/Qwen2.5-Coder-1.5B-Instruct` |
| Fine-tuning Method | QLoRA |
| Task Type | `CAUSAL_LM` |
| Number of Epochs | `3` |
| Batch Size | `1` |
| Gradient Accumulation Steps | `1` |
| Effective Batch Size | `1` |
| Learning Rate | `2e-4` |
| LR Scheduler Type | `cosine` |
| Warmup Ratio | `0.05` |
| Precision | `FP16 Mixed Precision` |
| Gradient Checkpointing | `True` |
| Completion-Only Loss | `True` |
| Packing | `False` |
| Max Sequence Length | `8192 tokens` |
| Logging Steps | every `10000` steps |
| Save Checkpoint Steps | every `10000` steps |
| Output Directory | `.model` |
#### PEFT/LoRA
| Parameter | Value |
|-----------------|-----------------------------------------------------------------------------|
| LoRA Rank (`r`) | `16` |
| LoRA Alpha | `32` |
| LoRA Dropout | `0.05` |
| LoRA Bias | `none` |
| Task Type | `CAUSAL_LM` |
| Target Modules | `q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj` |
| Modules to Save | `embed_tokens`, `lm_head` |
#### Model
| Parameter | Value |
|---------------------------|------------------------------------|
| Name | `Qwen/Qwen2.5-Coder-1.5B-Instruct` |
| Attention Implementation | `flash_attention_2` |
| load_in_4bit | `true` |
| bnb_4bit_quant_type | `nf4` |
| bnb_4bit_use_double_quant | `true` |
Aşağıda her başlık için ayrı birer tablo oluşturdum:
#### Dataset
| Parameter | Value |
|----------------------|--------------------------------|
| Dataset Name | `nvidia/OpenCodeReasoning` |
| Split | `split_0` |
| Number of Rows | `8000` |
| Max Token Length | `8192` |
| Shuffle | `True` |
| Number of Processes | `4` |
#### Tokenizer
| Parameter | Value |
|--------------------------------|-------------------------------|
| Truncation | Enabled (`max_length=8192`) |
| Masked Language Modeling (MLM) | `False` |
#### Speeds, Sizes, Times
| Parameter | Value |
|-------------------------|-------------------------------------------------------------|
| Total Training Time | ~3.5 hours |
| Checkpoint Frequency | every `10000` steps |
| Checkpoint Steps | `checkpoint-10000`, `checkpoint-20000`, `checkpoint-24000` |
#### Compute Infrastructure
| Parameter | Value |
|--------------|--------------------------------------|
| GPU | 1 × NVIDIA H100 SXM (80 GB VRAM) |
| RAM | 125 GB |
| CPU | 16 vCPU |
| OS | Ubuntu 22.04 |
| Frameworks | PyTorch 2.4.0 |
| CUDA Version | 12.4.1 |
---
### Licence
- [LICENSE](LICENSE)
---
### Links
- [Github](https://github.com/bunyaminergen/)
- [Website](https://bunyaminergen.com)
- [Linkedin](https://www.linkedin.com/in/bunyaminergen)
---
### Team
- [Bunyamin Ergen](https://www.linkedin.com/in/bunyaminergen)
---
### Contact
- [Mail](mailto:info@bunyaminergen.com)
---
### Reference
- This model has been fine-tuned using Supervised Fine Tuning (SFT) method from the original
model [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct).
---
### Citation
```bibtex
@software{ Qwen2.5-Coder-1.5B-Instruct-Reasoning,
author = {Bunyamin Ergen},
title = {{Qwen2.5-Coder-1.5B-Instruct-Reasoning}},
year = {2025},
month = {04},
}
```
--- |