huggingface-llm-trainer
하는 일
이 스킬은 클라우드 GPU에서 AI 언어 모델을 학습하거나 파인튜닝합니다. 로컬 GPU를 설정하지 않고 자기 용도에 맞게 모델을 맞춤 설정하려는 사람들을 위한 스킬입니다.
사용하는 경우
- ✓내 데이터셋으로 언어 모델을 파인튜닝하고 싶을 때.
- ✓SFT, DPO, GRPO, 보상 모델링 같은 방법으로 학습하고 싶을 때.
- ✓학습된 모델을 로컬에서 쓰기 위해 GGUF로 변환하고 싶을 때.
스킬 링크
https://github.com/huggingface/skills/blob/main/skills/huggingface-llm-trainer/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 고객 지원 예시로 작은 언어 모델을 파인튜닝하고, 결과를 제 Hugging Face 계정에 저장해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 데이터셋을 준비하고 확인하며, 하드웨어를 고르고 비용을 추정합니다. 그다음 학습 스크립트를 쓰고 Hugging Face Jobs에서 실행하며, 끝나면 학습된 모델을 Hub에 저장합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
TRL Training on Hugging Face Jobs
Overview
Train language models using TRL (Transformer Reinforcement Learning) on fully managed Hugging Face infrastructure. No local GPU setup required—models train on cloud GPUs and results are automatically saved to the Hugging Face Hub.
TRL provides multiple training methods:
- SFT (Supervised Fine-Tuning) - Standard instruction tuning
- DPO (Direct Preference Optimization) - Alignment from preference data
- GRPO (Group Relative Policy Optimization) - Online RL training
- Reward Modeling - Train reward models for RLHF
For detailed TRL method documentation:
hf_doc_search("your query", product="trl")
hf_doc_fetch("https://huggingface.co/docs/trl/sft_trainer") # SFT
hf_doc_fetch("https://huggingface.co/docs/trl/dpo_trainer") # DPO
# etc.
See also: references/training_methods.md for method overviews and selection guidance
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
FastVisionModelsupport
See references/unsloth.md for complete Unsloth documentation and scripts/unsloth_sft_example.py for a production-ready training script.
Key Directives
When assisting with training jobs:
ALWAYS use
hf_jobs()MCP tool - Submit jobs usinghf_jobs("uv", {...}), NOT bashtrl-jobscommands. Thescriptparameter accepts Python code directly. Do NOT save to local files unless the user explicitly requests it. Pass the script content as a string tohf_jobs(). If user asks to "train a model", "fine-tune", or similar requests, you MUST create the training script AND submit the job immediately usinghf_jobs().Always include Trackio - Every training script should include Trackio for real-time monitoring. Use example scripts in
scripts/as templates.Provide job details after submission - After submitting, provide job ID, monitoring URL, estimated time, and note that the user can request status checks later.
Use example scripts as templates - Reference
scripts/train_sft_example.py,scripts/train_dpo_example.py, etc. as starting points.
Local Script Execution
Repository scripts use PEP 723 inline dependencies. Run them with uv run:
uv run scripts/estimate_cost.py --help
uv run scripts/dataset_inspector.py --help
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_TOKENsyntax 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"}
Asynchronous Job Guidelines
**⚠️ IMPORTANT: Traini
자주 묻는 질문
로컬 GPU가 필요한가요?
아닙니다. 학습은 관리되는 클라우드 GPU에서 실행되므로 로컬 GPU 설정이 필요하지 않습니다.
학습된 모델은 보관되나요?
네. 결과는 자동으로 Hugging Face Hub에 저장됩니다.
비용을 추정하나요?
네. 학습 작업의 하드웨어를 고르는 과정에 비용 추정이 포함됩니다.
상세 정보
작성자의 원본 설명
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. Includes guidance on the TRL Jobs package, UV scripts with PEP 723 format, dataset preparation and validation, hardware selection, cost estimation, Trackio monitoring, Hub authentication, model selection/leaderboards and model persistence. Use for tasks involving cloud GPU training, GGUF conversion, or when users mention training on Hugging Face Jobs w
repo: huggingface/skills
인기도
- GitHub 스타
- 11k
- 순위
- #11774
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 10. 30.
댓글
- …
이 저장소의 다른 스킬
hf-cli
11k에이전트가 hf 명령줄 도구로 Hugging Face Hub의 모델, 데이터셋, Space, 저장소를 내려받고 올리며 로컬 캐시를 관리하도록 돕습니다.
hf-cloud-aws-context-discovery
11k에이전트가 클라우드 작업 전에 AWS 프로필, 리전, 계정 정보를 찾아, 어느 계정을 쓸지 추측하지 않도록 돕습니다.
hf-cloud-python-env-setup
11k에이전트가 SageMaker나 AWS 자동화를 실행하기 전에 적절한 Python 버전과 최신 라이브러리가 있는 깔끔한 Python 환경을 만들도록 돕습니다.
hf-cloud-sagemaker-deployment-planner
11k에이전트가 모델을 Amazon SageMaker에 배포하는 방법을 계획하고, 실시간, 서버리스, 비동기, 배치 호스팅 중 합리적인 기본값으로 고르도록 돕습니다.