Downloads · 30 days
37
29% of all-time downloads
pranavms13/gemma-4-12b-opus-4.7-distilled-lora
gemma-4-12b-opus-4.7-distilled-lora is a text generation model from pranavms13. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapters for unsloth/gemma-4-12b-it, supervised-fine-tuned on the coding slice of a Claude Opus 4.6/4.7 reasoning dataset to sharpen step-by-step coding and reasoning responses. Trained with Unsloth + TRL in 16-b…
Downloads · 30 days
37
29% of all-time downloads
All-time downloads
129
Public
Repo size
295 MB
Likes
1
Public
Click a slice to open those files.
.safetensors262 MB · 89%
From the Hugging Face model README
LoRA adapters for unsloth/gemma-4-12b-it,
supervised-fine-tuned on the coding slice of a Claude Opus 4.6/4.7 reasoning dataset to
sharpen step-by-step coding and reasoning responses. Trained with Unsloth
unsloth/gemma-4-12b-itThese are adapters only (~262 MB). You need the base model to run them.
Load the base model and attach the adapters for coding assistance, code explanation, and chain-of-thought style reasoning over programming tasks. The adapters were trained with the Gemma 4 chat template, masking the prompt so loss applies to assistant turns only.
Not tuned for the other 27 categories in the source dataset (only coding was used), nor for
non-English use, safety-critical decisions, or factual lookup. Outputs can be confidently wrong —
review generated code before running it. Subject to the Gemma license and prohibited-use policy.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "unsloth/gemma-4-12b-it"
adapter_id = "pranavms13/gemma-4-12b-opus-4.7-distilled-lora" # this folder / your HF repo id
tok = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id)
messages = [{"role": "user", "content": "Write a Python function that returns the nth Fibonacci number iteratively."}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=512)
print(tok.decode(out[0], skip_special_tokens=True))
With Unsloth:
from unsloth import FastModel
model, tok = FastModel.from_pretrained("pranavms13/gemma-4-12b-opus-4.7-distilled-lora", max_seq_length=8192, load_in_16bit=True)
angrygiraffe/claude-opus-4.6-4.7-reasoning-8.7k,
OpenAI-style chat JSONL (messages + category + model), filtered to category == "coding" →
9,768 examples. Formatted with the Gemma 4 chat template; trained on assistant responses only
(prompt tokens masked from the loss).
| Training regime | bf16 (16-bit LoRA, no QLoRA) |
LoRA rank r / alpha | 16 / 16 |
| LoRA dropout / bias | 0.0 / none |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Max sequence length | 8192 |
| Per-device batch size | 2 |
| Gradient accumulation | 4 (effective batch = 8) |
| Learning rate | 2e-4, linear schedule, 5 warmup steps |
| Epochs | 2 (2,442 steps) |
| Optimizer | adamw_torch_fused |
| Weight decay | 0.01 |
| Seed | 3407 |
Vision/audio layers frozen (text-only tune of a multimodal base); only the language layers trained.
adapter_model.safetensors).SFTTrainer), Transformers, PEFT 0.19.1, PyTorch (NVIDIA NGC container).expandable_segments:True to avoid OOM on unified memory.