Hugging Face Skills

repository·main·Indexed 27 days ago

https://github.com/huggingface/skills

A standardized set of definitions, instructions, scripts, and resources for AI/ML tasks designed for coding agents such as Claude Code, Cursor, Gemini CLI, Codex, and others. It includes a variety of skills for managing the Hugging Face Hub, deploying to Amazon SageMaker, training models with TRL or Unsloth, and building Gradio apps. The repository also provides tools for tracking hackathon engagement via collect_points.py and managing leaderboards.

Tokens
168.3K
Snippets
400
Records
753
Agent score
94%

What's inside huggingface-skills

  1. Overview of `hf` CLI commands

    main

    The hf CLI is used for managing models, datasets, spaces, buckets, repos, papers, jobs, and more on the Hugging Face Hub. Use hf --help to view all available functions.

    Key command groups include:

    • hf auth: Manage authentication (e.g., hf auth whoami).
    • hf buckets: Interact with buckets.
    • hf cache: Manage local cache directory.
    • hf collections: Interact with collections.
    • hf datasets: Interact with datasets.
    • hf discussions: Manage discussions and pull requests.
    • hf endpoints: Manage Hugging Face Inference Endpoints.
    • hf extensions: Manage hf CLI extensions.
    • hf jobs: Run and manage Jobs on the Hub.
  2. Overview of huggingface-paper-publisher capabilities

    main

    The huggingface-paper-publisher skill allows AI engineers and researchers to publish and manage research papers on the Hugging Face Hub.

    Key capabilities include:

    • Paper Page Management: Indexing papers from arXiv, claiming authorship, and managing profile visibility.
    • Artifact Linking: Connecting papers to Models or Datasets via metadata, adding citations to model cards, and utilizing automatic arxiv:<PAPER_ID> tagging.
    • Research Article Creation: Generating professional markdown-based research articles with LaTeX math support, dynamic Tables of Contents (TOC), and standard scientific section structures.
    • Metadata Management: Using YAML frontmatter for model/dataset cards and maintaining citation tracking across repositories.
  3. Train or fine-tune models using the huggingface-llm-trainer skill

    main

    The huggingface-llm-trainer skill allows you to train or fine-tune language and vision models using TRL (Transformer Reinforcement Learning) or Unsloth on managed Hugging Face Jobs infrastructure. This eliminates the need for local GPU setup as models train on cloud GPUs and results are automatically saved to the Hugging Face Hub.

    Supported TRL 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: Training reward models for RLHF.

    When to use Unsloth instead of standard TRL: Use Unsloth if you have limited GPU memory (uses ~60% less VRAM), need faster training (~2x speedup), are training large models (>13B), or are training Vision-Language Models (VLMs) using FastVisionModel support.

  4. Run local evaluations with inspect-ai and lighteval

    main

    Use this skill to run evaluations against Hugging Face Hub models on local hardware. It supports inspect-ai for explicit task control and lighteval for leaderboard-style benchmarks. You can choose between vllm for high throughput, or fallback to Hugging Face Transformers (--backend hf) or accelerate for compatibility.

    Note: This skill is for local execution only. To run these evaluations on remote hardware, hand off to the hugging-face-jobs skill using the same scripts and arguments.

  5. Use the Gradio LoRA Space Builder skill

    main

    The huggingface-lora-space-builder skill is used to build and publish a Gradio demo on Hugging Face Spaces for a user-provided LoRA. This is applicable when a user wants to create, generate, ship, or publish a Space, demo, Gradio app, or playground for LoRAs targeting models like Qwen-Image, Qwen-Image-Edit, LTX-Video, Wan, FLUX, or SDXL.

    By default, the skill targets ZeroGPU hardware and uses the diffusers library for inference when supported. The output is a real, published (private by default) Space rather than a local script.

  6. Compare 3D Mesh Generation Models

    main

    When choosing a model for a 3D generation Space, consider the trade-off between speed (fast tier) and fidelity (TRELLIS/Hunyuan3D).

    Fast Tier (Single-forward-pass)

    Best for snappy demos, high-traffic public Spaces, and low VRAM usage.

    • TripoSR: Untextured mesh (OBJ + GLB). MIT license, ungated. Minimal dependencies.
    • Stable Fast 3D (SF3D): UV-unwrapped textured GLB. Gated (requires license acceptance and HF_TOKEN).
    • SPAR3D: Textured GLB + editable point cloud. Gated (requires license acceptance and HF_TOKEN).

    High Fidelity / Two-Stage

    • TRELLIS / TRELLIS.2: High fidelity (refer to TRELLIS recipes for setup).
    • Hunyuan3D-2/2.1: Two-stage generation (Shape via DiT $\rightarrow$ Texture via Paint).
      • 2.0: RGB textures.
      • 2.1: PBR-textured.
      • Both are ungated but have non-commercial community licenses. Use 2.1 for finetuned shape checkpoints.
  7. Use the hf-llm-trainer skill for model fine-tuning

    main

    The hf-llm-trainer/ skill allows you to fine-tune and share models on the Hugging Face Hub. It supports several training methodologies and leverages HF Jobs for cloud GPU training, eliminating the need for local hardware setup.

    Key Capabilities:

    • SFT (Supervised Fine-Tuning): Standard instruction tuning.
    • DPO (Direct Preference Optimization): Alignment using preference data.
    • GRPO (Group Relative Policy Optimization): Online Reinforcement Learning (RL) training.
    • Cloud GPU Training: Submit jobs directly to HF infrastructure via hf_jobs().
    • Monitoring: Real-time monitoring via Trackio integration.
    • Deployment: GGUF conversion for local deployment.
  8. Use the SageMaker Deployment Planner skill

    main

    The hf-cloud-sagemaker-deployment-planner skill is the entry point for planning and coordinating model deployments to Amazon SageMaker AI. Use this skill when you want to deploy, host, serve, or expose a model on SageMaker or AWS (e.g., 'deploy a model', 'host this LLM on AWS', 'create an endpoint').

    It works for various model types including text-generation LLMs, embedding models, rerankers, classifiers, and text-to-image/diffusion models. The skill handles the initial discovery and pathway selection, then coordinates specialized skills for context discovery, IAM preflight, image selection, and final deployment.

  9. Use ModelRegistry for preflight model asset inspection

    main

    In Transformers.js v4, ModelRegistry provides a preflight API to inspect model assets, estimate download sizes, and check cache status before calling pipeline(). This is useful for managing bandwidth and supporting offline-first workflows.

    Import ModelRegistry from @huggingface/transformers and use the same task, modelId, and modelOptions tuple that you would pass to pipeline().

    import { ModelRegistry } from '@huggingface/transformers';
    
    const task = 'feature-extraction';
    const modelId = 'onnx-community/all-MiniLM-L6-v2-ONNX';
    const modelOptions = { dtype: 'fp32' };
  10. Understand the ZeroGPU process lifecycle

    main

    A ZeroGPU Space operates using two distinct processes with different lifetimes:

    1. Main web process: A long-lived process that imports app.py and runs the Gradio server. It holds no VRAM and, after the startup "pack" step, holds no model weights in RAM. It does not have a GPU attached.
    2. GPU worker processes: Short-lived processes forked per @spaces.GPU request (or reused if warm). These processes run the actual GPU tasks and are managed/killed by the ZeroGPU scheduler, not by your code.

    Because of this separation, you cannot perform GPU-bound operations (like model.generate()) at the module scope in the main process.

  11. Choose the right sparse encoder evaluator

    main

    All sparse-encoder evaluators are located in sentence_transformers.sparse_encoder.evaluation. They use dot product similarity by default. Select an evaluator based on your specific task:

    TaskEvaluator
    Retrieval (nDCG, MRR, Recall) — fast defaultSparseNanoBEIREvaluator
    Retrieval on your own corpus / qrelsSparseInformationRetrievalEvaluator
    STS / continuous similaritySparseEmbeddingSimilarityEvaluator
    Binary classificationSparseBinaryClassificationEvaluator
    Triplet accuracySparseTripletEvaluator
    Reranking (from retrieval candidates)SparseRerankingEvaluator
    MSE vs. teacher (distillation)SparseMSEEvaluator
    Translation (cross-lingual alignment)SparseTranslationEvaluator
    Hybrid BM25 + sparse retrievalReciprocalRankFusionEvaluator
  12. Use the HuggingFace Best Model Finder skill

    main

    The huggingface-best skill is used to find the best, top, or recommended AI models for a specific task. It is triggered by queries such as "best model for X", "what model should I use for", "top models for [task]", or "compare models for".

    The skill performs the following workflow:

    1. Parses the request to identify the Task (e.g., coding, math, OCR) and the Device (hardware constraints like RAM or VRAM).
    2. Calculates parameter budgets based on device memory:
      • fp16 max params (B) ≈ memory (GB) ÷ 2
      • Q4 max params (B) ≈ memory (GB) × 2
    3. Fetches benchmarks and retrieves top models from official Hugging Face leaderboards.
    4. Enriches metadata including parameter count, license, and quantization requirements.
    5. Filters and ranks models based on benchmark scores and hardware compatibility.
    6. Outputs a comparison table with model links, scores, and device compatibility status (e.g., Yes (fp16), Q4 only, Too large).