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
|
@@ -18,18 +18,22 @@ 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
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
##
|
| 26 |
|
| 27 |
-
|
| 28 |
-
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Training
|
| 35 |
|
|
@@ -37,25 +41,20 @@ Teaches the model to reason like an experienced engineer -- not just write code,
|
|
| 37 |
|---------|-------|
|
| 38 |
| Base model | `Qwen/Qwen2.5-Coder-7B-Instruct` |
|
| 39 |
| Method | LoRA (RS-LoRA) |
|
| 40 |
-
| Rank | 16
|
| 41 |
| Dropout | 0.05 |
|
| 42 |
| Epochs | 3 |
|
| 43 |
-
| Batch
|
| 44 |
| Learning rate | 2e-4 |
|
| 45 |
| Train pairs | 2,351 |
|
| 46 |
-
|
|
| 47 |
-
|
|
| 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) --
|
| 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 |
|
|
@@ -67,12 +66,3 @@ 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 |
-
```
|
|
|
|
| 18 |
- mechramc/codek-v1
|
| 19 |
---
|
| 20 |
|
| 21 |
+
# CodeK LoRA v0 -- Qwen2.5-Coder-7B-Instruct
|
| 22 |
|
| 23 |
+
A LoRA adapter fine-tuned on the **CodeK v1** dataset: a reasoning-first, pedagogical
|
| 24 |
+
coding dataset. Teaches decomposition, bug diagnosis, contrast reasoning, and
|
| 25 |
+
hypothesis-driven thinking about code.
|
| 26 |
|
| 27 |
+
## v0 Eval Results (Pass 2 ground-truth, 50 seeds)
|
| 28 |
|
| 29 |
+
| Model | Pass@1 |
|
| 30 |
+
|-------|--------|
|
| 31 |
+
| Base (Qwen2.5-Coder-7B-Instruct) | 64% |
|
| 32 |
+
| **LoRA checkpoint-800** | **58%** |
|
| 33 |
+
|
| 34 |
+
6% regression on bug diagnosis. LoRA wins on 2/50 seeds (more direct, correct),
|
| 35 |
+
base wins on 5/50 (LoRA misidentifies function or pattern-matches to training data).
|
| 36 |
+
See `BASELINE_V0.md` in the dataset repo for full analysis.
|
| 37 |
|
| 38 |
## Training
|
| 39 |
|
|
|
|
| 41 |
|---------|-------|
|
| 42 |
| Base model | `Qwen/Qwen2.5-Coder-7B-Instruct` |
|
| 43 |
| Method | LoRA (RS-LoRA) |
|
| 44 |
+
| Rank / Alpha | 16 / 32 |
|
| 45 |
| Dropout | 0.05 |
|
| 46 |
| Epochs | 3 |
|
| 47 |
+
| Batch (effective) | 8 |
|
| 48 |
| Learning rate | 2e-4 |
|
| 49 |
| Train pairs | 2,351 |
|
| 50 |
+
| Best eval loss | 0.0583 (step 528) |
|
| 51 |
+
| Checkpoint used | checkpoint-800 (eval loss 0.061) |
|
| 52 |
+
| Hardware | RunPod A100 80GB, 59 min |
|
|
|
|
| 53 |
|
| 54 |
## Dataset
|
| 55 |
|
| 56 |
+
[mechramc/codek-v1](https://huggingface.co/datasets/mechramc/codek-v1) --
|
| 57 |
+
201 seeds, 4 augmentation passes, 2,613 ShareGPT pairs.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
## Usage
|
| 60 |
|
|
|
|
| 66 |
model = PeftModel.from_pretrained(base, "mechramc/codek-qwen2.5-coder-7b-lora")
|
| 67 |
tokenizer = AutoTokenizer.from_pretrained("mechramc/codek-qwen2.5-coder-7b-lora")
|
| 68 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|