Skip to content
Skillpedia
Agents48k · #3225

hugging-face-model-trainer

Helps your agent train or fine-tune language and vision models. It uses Hugging Face Jobs infrastructure for various training methods.

What it does

This agent trains or fine-tunes AI models for understanding language and images. It uses advanced tools to improve model performance and can prepare them for use on your computer.

When to use it

  • ✓When you want to improve an AI model without needing a powerful computer.
  • ✓To train models using specific methods like SFT, DPO, or GRPO.
  • ✓When you want to convert a trained model to run locally on tools like Ollama.

Example of what to ask your AI

“Train a language model to answer questions about cooking using the SFT method and save it as 'my-cooking-model'.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-model-trainer/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-model-trainer/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

You provide your data and choose the training method. The agent uses Hugging Face's infrastructure to do the heavy lifting on servers with powerful GPUs. Afterward, it can convert the model for you to use anywhere.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill hugging-face-model-trainer

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-model-trainer/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

TRL Training on Hugging Face Jobs

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use This Skill

Use this skill when users want to:

  • Fine-tune language models on cloud GPUs without local infrastructure
  • Train with TRL methods (SFT, DPO, GRPO, etc.)
  • Run training jobs on Hugging Face Jobs infrastructure
  • Convert trained models to GGUF for local deployment (Ollama, LM Studio, llama.cpp)
  • Ensure trained models are permanently saved to the Hub
  • Use modern workflows with optimized defaults

When to Use Unsloth

Use Unsloth (references/unsloth.md) instead of standard TRL when:

  • Limited GPU memory - Unsloth uses ~60% less VRAM
  • Speed matters - Unsloth is ~2x faster
  • Training large models (>13B) - memory efficiency is critical
  • Training Vision-Language Models (VLMs) - Unsloth has FastVisionModel support

See references/unsloth.md for complete Unsloth documentation and scripts/unsloth_sft_example.py for a production-ready training script.

Prerequisites Checklist

Before starting any training job, verify:

✅ Account & Authentication

  • Hugging Face Account with Pro, Team, or Enterprise plan (Jobs require paid plan)
  • Authenticated login: Check with hf_whoami()
  • HF_TOKEN for Hub Push ⚠️ CRITICAL - Training environment is ephemeral, must push to Hub or ALL training results are lost
  • Token must have write permissions
  • MUST pass secrets={"HF_TOKEN": "$HF_TOKEN"} in job config to make token available (the $HF_TOKEN syntax references your actual token value)

✅ Dataset Requirements

  • Dataset must exist on Hub or be loadable via datasets.load_dataset()
  • Format must match training method (SFT: "messages"/text/prompt-completion; DPO: chosen/rejected; GRPO: prompt-only)
  • ALWAYS validate unknown datasets before GPU training to prevent format failures (see Dataset Validation section below)
  • Size appropriate for hardware (Demo: 50-100 examples on t4-small; Production: 1K-10K+ on a10g-large/a100-large)

⚠️ Critical Settings

  • Timeout must exceed expected training time - Default 30min is TOO SHORT for most training. Minimum recommended: 1-2 hours. Job fails and loses all progress if timeout is exceeded.
  • Hub push must be enabled - Config: push_to_hub=True, hub_model_id="username/model-name"; Job: secrets={"HF_TOKEN": "$HF_TOKEN"}

Example Training Scripts

Production-ready templates with all best practices:

Load these scripts for correctly:

  • scripts/train_sft_example.py - Complete SFT training with Trackio, LoRA, checkpoints
  • scripts/train_dpo_example.py - DPO training for preference learning
  • scripts/train_grpo_example.py - GRPO training for online RL

These scripts demonstrate proper Hub saving, Trackio integration, checkpoint management, and optimized parameters. Pass their content inline to hf_jobs() or use as templates for custom scripts.

Limitations

  • Use this skill only when the task clearly matches its upstream product or API scope.
  • Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.
  • Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.
FAQ

Do I need to pay to use this agent?

Yes, Hugging Face Jobs, which is used for training, requires a paid plan (Pro, Team, or Enterprise).

What does 'fine-tune' mean?

It's like teaching an AI model that already knows a lot about something (like language) to specialize in a specific topic, such as cooking or medicine.

What is GGUF?

GGUF is a special format that allows trained AI models to run efficiently on regular computers, using programs like Ollama or LM Studio.

Details

Original description by the author

Train or fine-tune language and vision models using TRL (Transformer Reinforcement Learning) or Unsloth with Hugging Face Jobs infrastructure. Covers SFT, DPO, GRPO and reward modeling training methods, plus GGUF conversion for local deployment.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#3225
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills