Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Fine-tunes and aligns language models using TRL with SFT, DPO, GRPO, and RLOO.
87% 96%+9 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 20 of 23 without it.
3 of 3 safety checks passed
37 agent runs
2 forksA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
TRL provides post-training methods for aligning language models with human preferences.
Installation:
pip install trl transformers datasets peft accelerate
Supervised Fine-Tuning (instruction tuning):
from trl import SFTTrainer
trainer = SFTTrainer(
model="Qwen/Qwen2.5-0.5B",
train_dataset=dataset, # Prompt-completion pairs
)
trainer.train()
DPO (align with preferences):
from trl import DPOTrainer, DPOConfig
config = DPOConfig(output_dir="model-dpo", beta=0.1)
trainer = DPOTrainer(
model=model,
args=config,
train_dataset=preference_dataset, # chosen/rejected pairs
processing_class=tokenizer
)
trainer.train()
Published skills whose descriptions closely match this one, with their benchmark result.
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.