huggingfacehuggingfaceOfficialยท2 Agent Skills Included

trl

Post-train and align language models with proven RL methods

Trains and aligns language models using SFT, DPO, GRPO, KTO, reward modeling, and distillation. Removes the need to hand-write complex reinforcement learning loops, distributed training setups, and memory optimizations. Scales from a single GPU to multi-node clusters with LoRA, DeepSpeed, and vLLM support, plus a no-code CLI for quick fine-tuning runs.
npx skills add huggingface/trl --all -g -y

All Skills in This Repository (2)

Pure Emerald Level Indicators

Frequently Asked Questions

FAQPage Schema
How to install TRL?โ–ผ

Run `npx skills add huggingface/trl --all -g -y` in your terminal to install all tools in this suite globally.

What is TRL used for?โ–ผ

TRL post-trains language models using methods like SFT, DPO, GRPO, and KTO. It helps you align models with human preferences or reward functions without writing training loops from scratch.

How to fine-tune a model with GRPO?โ–ผ

Load a prompt dataset, define a reward function, and pass both to GRPOTrainer with your model name. Enable vLLM with use_vllm=True to speed up generation during training.

Can I train large models on limited hardware?โ–ผ

Yes. TRL integrates with PEFT for LoRA and QLoRA, supports quantization, and works with DeepSpeed and FSDP for multi-GPU or multi-node scaling.

Does TRL work without writing Python code?โ–ผ

Yes. The built-in CLI lets you run commands like `trl sft` or `trl dpo` with your model and dataset names, no custom code required.

Related Repositories in Software Engineering

View All in Software Engineeringโ†’