huggingface-vision-trainer
Trains and fine-tunes vision models for object detection (D-FINE, RT-DETR v2, DETR, YOLOS), image classification (timm models — MobileNetV3, MobileViT…
Skill by huggingfaceOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/huggingface-huggingface-vision-trainer
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/huggingface-vision-trainer
What's inside
- Skill name
huggingface-vision-trainer- Description
- Trains and fine-tunes vision models for object detection (D-FINE, RT-DETR v2, DETR, YOLOS), image classification (timm models — MobileNetV3, MobileViT, ResNet, ViT/DINOv3 — plus any Transformers classifier), and SAM/SAM2 segmentation using Hugging Face Transformers on Hugging Face Jobs cloud GPUs. Covers COCO-format dataset preparation, Albumentations augmentation, mAP/mAR evaluation, accuracy metrics, SAM segmentation with bbox/point prompts, DiceCE loss, hardware selection, cost estimation, Trackio monitoring, and Hub persistence. Use when users mention training object detection, image classification, SAM, SAM2, segmentation, image matting, DETR, D-FINE, RT-DETR, ViT, timm, MobileNet, ResNet, bounding box models, or fine-tuning vision models on Hugging Face Jobs.
- License
- Apache-2.0
- Instructions
- 590 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- body: 590 lines (spec recommends under 500)
Files (12)
- SKILL.md
- finetune_sam2_trainer.md · references/
- hub_saving.md · references/
- image_classification_training_notebook.md · references/
- object_detection_training_notebook.md · references/
- reliability_principles.md · references/
- timm_trainer.md · references/
- dataset_inspector.py · scripts/
- estimate_cost.py · scripts/
- image_classification_training.py · scripts/
- object_detection_training.py · scripts/
- sam_segmentation_training.py · scripts/
SKILL.md (first lines)
# Vision Model Training on Hugging Face Jobs
Train object detection, image classification, and SAM/SAM2 segmentation models on managed cloud GPUs. No local GPU setup required—results are automatically saved to the Hugging Face Hub.
## When to Use This Skill
Use this skill when users want to:
- Fine-tune object detection models (D-FINE, RT-DETR v2, DETR, YOLOS) on cloud GPUs or local
- Fine-tune image classification models (timm: MobileNetV3, MobileViT, ResNet, ViT/DINOv3, or any Transformers classifier) on cloud GPUs or local
- Fine-tune SAM or SAM2 models for segmentation / image matting using bbox or point prompts
- Train bounding-box detectors on custom datasets
- Train image classifiers on custom datasets
- Train segmentation models on custom mask datasets with prompts
- Run vision training jobs on Hugging Face Jobs infrastructure
- Ensure trained vision models are permanently saved to the Hub
## Related Skills
- **`hugging-face-jobs`** — General HF Jobs infrastructure: token authentication, hardware flavors, timeout management, cost estimation, secrets, environment variables, scheduled jobs, and result persistence. **Refer to the Jobs skill for any non-training-specific Jobs questions** (e.g., "how do secrets work?", "what hardware is available?", "how do I pass tokens?").
- **`hugging-face-model-trainer`** — TRL-based language model training (SFT, DPO, GRPO). Use that skill for text/language model fine-tuning.
## Local Script Execution
Helper scripts use PEP 723 inline dependencies. Run them with `uv run`:
```bash
uv run scripts/dataset_inspector.py --dataset username/dataset-name --split train
uv run scripts/estimate_cost.py --help
```
## Prerequisites Checklist
Before starting any training job, verify:
### Account & Authentication
- Hugging Face Account with [Pro](https://hf.co/pro), [Team](https://hf.co/enterprise), or [Enterprise](https://hf.co/enterprise) plan (Jobs require paid plan)
- Authenticated login: Check with `hf_whoami()` (tool) or `hf auth whoami` (terminal)
- Token has **write** permissions
- **MUST pass token in job secrets** — see directive #3 below for syntax (MCP tool vs Python API)
### Dataset Requirements — Object Detection
- Dataset must exist on Hub
- Annotations must use the `objects` column with `bbox`, `category` (and optionally `area`) sub-fields
- Bboxes can be in **xywh (COCO)** or **xyxy (Pascal VOC)** format — auto-detected and converted
- Categories can be **integers or strings** — strings are auto-remapped to integer IDs
- `image_id` column is **optional** — generated automatically if missing
- **ALWAYS validate unknown datasets** before GPU training (see Dataset Validation section)
### Dataset Requirements — Image Classification
- Dataset must exist on Hub
- Must have an **`image` column** (PIL images) and a **`label` column** (integer class IDs or strings)
- The label column can be `ClassLabel` type (with names) or plain integers/strings — strings are auto-remapped
- Common column names auto-detected: `label`, `labels`, `class`, `fine_label`
- **ALWAYS validate unknown datasets** before GPU training (see Dataset Validation section)
### Dataset Requirements — SAM/SAM2 Segmentation
- Dataset must exist on Hub
- Must have an **`image` column** (PIL images) and a **`mask` column** (binary ground-truth segmentation mask)
- Must have a **prompt** — either:
- A **`prompt` column** with JSON containing `{"bbox": [x0,y0,x1,y1]}` or `{"point": [x,y]}`
- OR a dedicated **`bbox`** column with `[x0,y0,x1,y1]` values
- OR a dedicated **`point`** column with `[x,y]` or `[[x,y],...]` values
- Bboxes should be in **xyxy** format (absolute pixel coordinates)
- Example dataset: `merve/MicroMat-mini` (image matting with bbox prompts)
- **ALWAYS validate unknown datasets** before GPU training (see Dataset Validation section)
### Critical Settings
- **Timeout must exceed expected training time** — Default 30min is TOO SHORT. See directive #6 for recommended values.
- **Hub push must be enabled** — `push_to_hub=True`, `hub_model_id="username/model-name"`, token in `secrets`
## Dataset Validation
**Validate dataset format BEFORE launching GPU training to prevent the #1 cause of training failures: format mismatches.**
**ALWAYS validate for** unknown/custom datasets or any dataset you haven't trained with before. **Skip for** `cppe-5` (the default in the training script).
### Running the Inspector
**Option 1: Via HF Jobs (recommended — avoids local SSL/dependency issues):**
```python
hf_jobs("uv", {
"script": "path/to/dataset_inspector.py",
"script_args": ["--dataset", "username/dataset-name", "--split", "train"]
})
```
**Option 2: Locally:**
```bash
uv run scripts/dataset_inspector.py --dataset username/dataset-name --split train
```
**Option 3: Via `HfApi().run_uv_job()` (if hf_jobs MCP unavailable):**
```python
from huggingface_hub import HfApi
api = HfApi()
api.run_uv_job(
script="scripts/dataset_inspector.py",
script_args=["--dataset", "username/dataset-name", "--split", "train"],
flavor="cpu-basic",
timeout=300,
)
```
### Reading Results
- **`✓ READY`** — Dataset is compatible, use directly
- **`✗ NEEDS FORMATTING`** — Needs preprocessing (mapping code provided in output)
## Automatic Bbox Preprocessing
The object detection training script (`scripts/object_detection_training.py`) automatically handles bbox format detection (xyxy→xywh conversion), bbox sanitization, `image_id` generation, string category→integer remapping, and dataset truncation. **No manual preprocessing needed** — just ensure the dataset has `objects.bbox` and `objects.category` columns.
## Training workflow
Copy this checklist and track progress:
```
Training Progress:
- [ ] Step 1: Verify prerequisites (account, token, dataset)
- [ ] Step 2: Validate dataset format (run dataset_inspector.py)From huggingface/skills, Apache-2.0.
More from huggingface/skills
- 0.856score
hf-cli
huggingfaceOfficial
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.856score
trl-training
huggingfaceOfficial
Post-train LLMs with TRL (Transformers Reinforcement Learning) — SFT, DPO, GRPO, KTO, and reward-model training.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-iam-preflight
huggingfaceOfficial
Ensure a usable SageMaker execution role exists before deploying or training.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
huggingface-spaces
huggingfaceOfficial
Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-serving-image-selection
huggingfaceOfficial
Pick the right serving container for a SageMaker model deployment and find its current image URI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-production-defaults
huggingfaceOfficial
Create a SageMaker endpoint (real-time, real-time scale-to-zero, or async) with autoscaling, CloudWatch alarms, and tagging enabled by default.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
train-sentence-transformers
huggingfaceOfficial
Train or fine-tune sentence-transformers models across `SentenceTransformer` (bi-encoder, dense or static embedding model for retrieval, similarity…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.809score
hf-cloud-sagemaker-deployment-planner
huggingfaceOfficial
Plan and coordinate the deployment of a model to Amazon SageMaker AI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.781score
huggingface-best
huggingfaceOfficial
Use when the user asks about finding the best, top, or recommended model for a task, wants to know what AI model to use, or wants to compare models by…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.758score
huggingface-trackio
huggingfaceOfficial
Track and visualize ML training experiments with Trackio.
SkillCFreshness: C★ 11.2KClaude Code +9 - 0.758score
hf-cloud-python-env-setup
huggingfaceOfficial
Set up an isolated Python environment for SageMaker / AWS work, with the right Python version and current boto3.
SkillCFreshness: C★ 11.2KClaude Code +9 - 0.758score
huggingface-lora-space-builder
huggingfaceOfficial
Build and publish a Gradio demo on Hugging Face Spaces for a user-provided LoRA.
SkillCFreshness: C★ 11.2KClaude Code +9
Signals
- Stars
- 11,208
- Forks
- 778
- Open issues
- 13
- Contributors
- 43
- Last commit (this folder)
- Mar 23, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/huggingface/skills
- Website
- huggingface.co
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
More from huggingface
- 0.856score
hf-cli
huggingfaceOfficial
Hugging Face Hub CLI (`hf`) for downloading, uploading, and managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.856score
trl-training
huggingfaceOfficial
Post-train LLMs with TRL (Transformers Reinforcement Learning) — SFT, DPO, GRPO, KTO, and reward-model training.
SkillAFreshness: A★ 11.2KClaude Code +9 - 0.815score
hf-cloud-serving-image-selection
huggingfaceOfficial
Pick the right serving container for a SageMaker model deployment and find its current image URI.
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
huggingface-spaces
huggingfaceOfficial
Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
train-sentence-transformers
huggingfaceOfficial
Train or fine-tune sentence-transformers models across `SentenceTransformer` (bi-encoder, dense or static embedding model for retrieval, similarity…
SkillBFreshness: B★ 11.2KClaude Code +9 - 0.815score
hf-cloud-sagemaker-production-defaults
huggingfaceOfficial
Create a SageMaker endpoint (real-time, real-time scale-to-zero, or async) with autoscaling, CloudWatch alarms, and tagging enabled by default.
SkillBFreshness: B★ 11.2KClaude Code +9
Cite this page
huggingface-vision-trainer skill. Agent Mart. https://agentmart.dev/skills/huggingface-huggingface-vision-trainer (last updated 2026-10-24)