Downloads · 30 days
0
ahmadalmoustafa/zephyr-qwen2.5-coder-7b-lora-checkpoint100
zephyr-qwen2.5-coder-7b-lora-checkpoint100 is a machine learning model from ahmadalmoustafa. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Aug 16, 2026
Repo size
173 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 93%
From the Hugging Face model README
---
base_model: Qwen/Qwen2.5-Coder-7B
library_name: peft
pipeline_tag: text-generation
tags:
- lora
- code-completion
- zephyr
- rtos
- c
- cpp
- multi-gpu
---
# Zephyr RTOS Code Completion — Qwen2.5-Coder-7B LoRA
This is the validation-selected LoRA adapter for Zephyr RTOS code completion. It improved both the general Zephyr and dedicated C++ held-out benchmarks.
## Base model
- Model: Qwen/Qwen2.5-Coder-7B
- Revision: 0396a76181e127dfc13e5c5ec48a8cee09938b02
- Selected checkpoint: checkpoint-100
- Adapter type: LoRA
- LoRA rank: 16
- LoRA alpha: 32
This release contains adapter weights, not a complete merged model. The original Qwen base model is required for inference.
## Training
- Hardware: five NVIDIA TITAN RTX GPUs
- Parallelism: Accelerate DistributedDataParallel
- One complete model replica per GPU
- Per-device batch size: 2
- Gradient accumulation: 3
- Effective global batch size: 30
- Mixed precision: FP16
- Maximum sequence length: 1,024 tokens
- Selected training step: 100
- Approximate examples processed: 3,000
Checkpoint 100 was selected using the C++ validation split. The held-out evaluation benchmarks were not read during checkpoint selection.
## Training data
- Zephyr version: v4.4.1
- Zephyr commit: 1f6485eca25431b5ff27ce9a754218c9e559bbbb
- Cleaned source files: 12,823
- Effective weighted training examples: 80,856
- Effective C++ examples: 16,104
- Effective C++ sampling share: 19.92%
- Languages: C, C headers, C++, and C++ headers
Directory grouping and exact-file-hash isolation were used to prevent source leakage across the training, validation, and evaluation splits. Validation and evaluation datasets were not modified during C++ reweighting.
## Held-out evaluation
### Teacher-forced metrics
| Benchmark | Base NLL | LoRA NLL | NLL reduction | Accuracy change |
|---|---:|---:|---:|---:|
| General Zephyr, 512 examples | 0.740071 | 0.687411 | 7.12% | +0.33 points |
| C++, 62 examples | 0.653255 | 0.606977 | 7.08% | +0.46 points |
### Greedy-generation metrics
| Benchmark | Base first-line | LoRA first-line | Base edit similarity | LoRA edit similarity |
|---|---:|---:|---:|---:|
| General Zephyr | 40.23% | 42.97% | 32.91% | 35.00% |
| C++ | 59.68% | 64.52% | 36.50% | 37.69% |
Measured generation lift:
- General exact match: +2.53 points
- General first-line match: +2.74 points
- General edit similarity: +2.08 points
- C++ first-line match: +4.84 points
- C++ edit similarity: +1.19 points
## Model-selection note
Only 47 C++ validation examples were available. Checkpoint 100 improved high-priority C++ validation NLL while satisfying the all-C++ accuracy guardrail.
The final 512-example general and 62-example C++ benchmarks were evaluated only after checkpoint selection.
## Usage
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base\_model\_name = "Qwen/Qwen2.5-Coder-7B"
base\_revision = "0396a76181e127dfc13e5c5ec48a8cee09938b02"
adapter\_path = "."
tokenizer = AutoTokenizer.from\_pretrained(adapter\_path)
base\_model = AutoModelForCausalLM.from\_pretrained(
  base\_model\_name,
  revision=base\_revision,
  torch\_dtype=torch.float16,
  device\_map="auto",
)
model = PeftModel.from\_pretrained(base\_model, adapter\_path)
model.eval()
prompt = """#include <zephyr/kernel.h>
int main(void)
{
"""
inputs = tokenizer(prompt, return\_tensors="pt").to(model.device)
with torch.no\_grad():
  output = model.generate(
  \*\*inputs,
  max\_new\_tokens=128,
  do\_sample=False,
  )
print(tokenizer.decode(output\[0], skip\_special\_tokens=True))
## Intended use and limitations
This adapter is intended for research and demonstration of parameter-efficient Zephyr RTOS code adaptation.
The C++ evaluation contains 62 completions from 16 source files. The results provide held-out evidence but do not establish production readiness. Generated embedded code must be reviewed, compiled, and tested before use.