跳到主要内容
知仓学习社ZHICANG

hugging-face-vision-trainer

Train object detection, image classification, and SAM or SAM2 segmentation models locally or on Hugging Face Jobs, with dataset validation and resul…

读凭据联网严重 0 · 高危 6sickn33/agentic-awesome-skills

它会碰到什么

扫了多少13 个文本文件,197 KB
它会碰到什么读凭据联网
命中总数15 处
命中统计严重 0 · 高 6 · 中 4 · 低 2
逐条看命中(6 条严重或高危)
  • scripts/image_classification_training.py:176cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")
  • scripts/image_classification_training.py:176cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")
  • scripts/object_detection_training.py:479cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")
  • scripts/object_detection_training.py:479cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")
  • scripts/sam_segmentation_training.py:243cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")
  • scripts/sam_segmentation_training.py:243cred-envread
    hf_token = os.environ.get("HF_TOKEN") or os.environ.get("hfjob")

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

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.

Detailed Guide

Read [the detailed guide](references/detailed-guide.md) 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 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

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() (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 enabledpush_to_hub=True, hub_model_id="username/model-name", token in secrets

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.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 46,490
本站分层T1
该仓技能数6676
原文件路径plugins/agentic-awesome-skills-claude/skills/hugging-face-vision-trainer/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 6676 个技能

同名技能的其他版本

有 3 个不同仓库或目录里都有叫 hugging-face-vision-trainer 的技能。它们内容并不相同,别混用: