Text Generation
PEFT
Safetensors
English
lora
qwen2.5
qwen2.5-coder
code
reasoning
pedagogy
fine-tuned
conversational
Instructions to use mechramc/codek-qwen2.5-coder-7b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use mechramc/codek-qwen2.5-coder-7b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Coder-7B-Instruct") model = PeftModel.from_pretrained(base_model, "mechramc/codek-qwen2.5-coder-7b-lora") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,63 +1,78 @@
|
|
| 1 |
-
---
|
| 2 |
-
base_model:
|
| 3 |
-
library_name: peft
|
| 4 |
-
|
| 5 |
-
tags:
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
|
| 3 |
+
library_name: peft
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- peft
|
| 8 |
+
- qwen2.5
|
| 9 |
+
- qwen2.5-coder
|
| 10 |
+
- code
|
| 11 |
+
- reasoning
|
| 12 |
+
- pedagogy
|
| 13 |
+
- fine-tuned
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
+
license: apache-2.0
|
| 17 |
+
datasets:
|
| 18 |
+
- mechramc/codek-v1
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
# CodeK LoRA -- Qwen2.5-Coder-7B-Instruct
|
| 22 |
+
|
| 23 |
+
A LoRA adapter fine-tuned on the **CodeK v1** dataset: a reasoning-first, pedagogical coding dataset in Karpathy's register.
|
| 24 |
+
|
| 25 |
+
## What it does
|
| 26 |
+
|
| 27 |
+
Teaches the model to reason like an experienced engineer -- not just write code, but:
|
| 28 |
+
- Decompose problems before implementing
|
| 29 |
+
- Explain *why* a solution is the right one
|
| 30 |
+
- Identify and diagnose subtle bugs
|
| 31 |
+
- Contrast clean vs clunky implementations with precision
|
| 32 |
+
- Apply a hypothesis->experiment->evaluate loop to code
|
| 33 |
+
|
| 34 |
+
## Training
|
| 35 |
+
|
| 36 |
+
| Setting | Value |
|
| 37 |
+
|---------|-------|
|
| 38 |
+
| Base model | `Qwen/Qwen2.5-Coder-7B-Instruct` |
|
| 39 |
+
| Method | LoRA (RS-LoRA) |
|
| 40 |
+
| Rank | 16, Alpha 32 |
|
| 41 |
+
| Dropout | 0.05 |
|
| 42 |
+
| Epochs | 3 |
|
| 43 |
+
| Batch size | 2 (effective 8 with grad accum) |
|
| 44 |
+
| Learning rate | 2e-4 |
|
| 45 |
+
| Train pairs | 2,351 |
|
| 46 |
+
| Val pairs | 262 |
|
| 47 |
+
| Final eval loss | 0.0600 |
|
| 48 |
+
| Hardware | RunPod A100 80GB |
|
| 49 |
+
| Training time | 59 minutes |
|
| 50 |
+
|
| 51 |
+
## Dataset
|
| 52 |
+
|
| 53 |
+
[mechramc/codek-v1](https://huggingface.co/datasets/mechramc/codek-v1) -- 201 seeds, 2,613 ShareGPT pairs across 4 augmentation passes:
|
| 54 |
+
|
| 55 |
+
- **Pass 1** -- Reasoning decomposition (intuition, plan, why this solution, alternatives)
|
| 56 |
+
- **Pass 2** -- Debugging (introduce + diagnose a subtle one-line bug)
|
| 57 |
+
- **Pass 3** -- Contrast (clunky vs clean, with specific explanation)
|
| 58 |
+
- **Pass 4** -- Research loop (hypothesis, minimal test, success metric, simplicity check, abandon condition)
|
| 59 |
+
|
| 60 |
+
## Usage
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from peft import PeftModel
|
| 64 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 65 |
+
|
| 66 |
+
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct")
|
| 67 |
+
model = PeftModel.from_pretrained(base, "mechramc/codek-qwen2.5-coder-7b-lora")
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained("mechramc/codek-qwen2.5-coder-7b-lora")
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Or with Unsloth (2-5x faster inference):
|
| 72 |
+
```python
|
| 73 |
+
from unsloth import FastLanguageModel
|
| 74 |
+
model, tokenizer = FastLanguageModel.from_pretrained(
|
| 75 |
+
"mechramc/codek-qwen2.5-coder-7b-lora",
|
| 76 |
+
max_seq_length=4096,
|
| 77 |
+
)
|
| 78 |
+
```
|