subagent-driven-development
OBobra/superpowers298k2,631 new stars in the last 7 days
Trigger this skill when the user wants to train, fine-tune, or adapt Gemma models (e.g. SFT, DPO, RLHF, Reward Modeling) on local hardware. Covers TRL, Unsloth, dataset preparation, validation, and GGUF/LiteRT conversion.
When training locally, memory efficiency and execution speed are huge. Always guide the user to follow these best practices:
SFTTrainer, DPOTrainer) coupled with PEFT and bitsandbytes (for QLoRA).Help the user choose the correct workflow based on their goal:
Formatting issues are the #1 cause of poor training runs. Ensure you validate files using the utility script [assets/dataset_prep.py].
Ensure the dataset matches Gemma's official chat template:
<|turn>system
Your instruction here<turn|>
<|turn>user
Your query here<turn|>
<|turn>model
Your response here<turn|>
To avoid formatting drift, use the tokenizer's apply_chat_template during dataset tokenization.
{
"messages": [
{"role": "user", "content": "Tell me a joke."},
{"role": "model", "content": "Why did the computer go to the doctor? It had a virus!"}
]
}
{
"prompt": "Write a python function to compute factorial.",
"chosen": "def factorial(n):\n return 1 if n <= 1 else n * factorial(n - 1)",
"rejected": "factorial is computed using recursion or loops. Just import math."
}
RewardTrainer evaluates the pair and learns to output a higher logit score for chosen than for rejected.Local knowledge distillation allows you to train small, lightweight student models (such as Gemma 4 E2B) using high-quality dataset outputs generated by larger, highly capable teacher models (such as Gemma 4 31B or Gemma 4 26B A4B).
Use the [assets/distill_dataset.py] utility script to generate fine-tuning datasets on your local machine.
Use the [assets/sft_train.py] asset to launch a local QLoRA fine-tuning session.
r): 16 or 32 (Higher rank captures complex behaviors but consumes more memory).lora_alpha): 32 or 64 (Rule of thumb: lora_alpha = 2 * r).lora_dropout): 0.05 or 0.1 (Forcing the model to learn more robust features rather than relying on specific paths).2e-4 for QLoRA; 2e-5 for full fine-tuning.Use the [assets/dpo_train.py] template to execute alignment.
beta (DPO temperature parameter) to 0.1. Values between 0.1 and 0.5 control how strictly the model adheres to the reference policy.Use the [assets/reward_train.py] template to train an evaluation model.
AutoModelForSequenceClassification with num_labels=1).Gemma 4 models are natively multimodal. To fine-tune them on images or audio:
SFTTrainer with a custom visual data collator.{
"messages": [
{"role": "user", "content": [
{"type": "image", "url": "path/to/image.png"},
{"type": "text", "text": "Describe this image."}
]},
{"role": "assistant", "content": [
{"type": "text", "text": "An abstract oil painting with vibrant warm gradients."}
]}
]
}
input_features.image type with audio type in the message format.
{
"messages": [
{"role": "user", "content": [
{"type": "text", "text": "Describe this audio."},
{"type": "audio", "url": "path/to/audio.wav"}
]},
{"role": "assistant", "content": [
{"type": "text", "text": "This is an audio file of a bird chirping."}
]}
]
}
Once your LoRA training is finished, you can convert your model to GGUF format.
If you trained your model using Unsloth, you can export directly to GGUF natively. This automatically handles merging and quantization.
Fetch Saving to GGUF for the best practice.
If you did not use Unsloth, you can convert your merged Hugging Face model directory manually using llama.cpp.
LiteRT-LM is optimized for running models like Gemma 4 E2B and Gemma 4 E4B on mobile, web, and IoT hardware with hardware acceleration (CPU, GPU, NPU). Fetch LiteRT-LM guide for the best practice.
OBobra/superpowers298k2,631 new stars in the last 7 days
MAmattpocock/skills288k10,178 new stars in the last 7 days
MAmattpocock/skills288k10,178 new stars in the last 7 days
MAmattpocock/skills288k10,178 new stars in the last 7 days
AFaffaan-m/ECC278k4,046 new stars in the last 7 days
AFaffaan-m/ECC278k4,046 new stars in the last 7 days