DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to fine-tune a small model from the command line with TRL

Run supervised fine-tuning on Qwen2.5-0.5B with a public dataset using only the TRL CLI.

Short answer: Install TRL with pip install trl; then run trl sft --model_name_or_path Qwen/Qwen2.5-0.5B with --dataset_name trl-lib/Capybara and --output_dir Qwen2.5-0.5B-SFT; wait for training to finish and check the output folder. All steps.

  • Top pick
  • Software and DevOps
  • Intermediate
  • 1 hour
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

cost. Training uses a lot of GPU time; on cloud GPUs that is billed by the hour.

Who it is forA developer who wants a first fine-tune without writing a training script.

The problemTraining scripts have a lot of boilerplate for a first experiment.

The outcomeA fine-tuned checkpoint saved to an output folder.

What you need first

  • Python with pip
  • A GPU is strongly recommended; the README covers NVIDIA, AMD and AWS Trainium setups
  • Access to Hugging Face Hub models and datasets

Steps

  1. Install TRL with pip install trl
  2. Run trl sft --model_name_or_path Qwen/Qwen2.5-0.5B with --dataset_name trl-lib/Capybara and --output_dir Qwen2.5-0.5B-SFT
  3. Wait for training to finish and check the output folder
  4. Run TRL sft with --help to see more options

Prompt for your agent

Using huggingface/trl, install it with `pip install trl`, run `trl sft --model_name_or_path Qwen/Qwen2.5-0.5B` with `--dataset_name trl-lib/Capybara` and `--output_dir Qwen2.5-0.5B-SFT`, and tell me how to load the result for a quick chat test.

Caveat. Run time depends heavily on your GPU.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for huggingface/trl and "Fine-tune a small model from the command line"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer