patchy631/ai-engineering-hub/hugging-face-jobs
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when users want to run any workload on Hugging Face Jobs infrastructure. Covers UV scripts, Docker-based jobs, hardware selection, cost estimation, authentication with tokens, secrets management, timeout configuration, and result persistence. Designed for general-purpose compute workloads including data processing, inference, experiments, batch jobs, and any Python-based tasks. Should be invoked for tasks involving cloud compute, GPU workloads, or when users mention running jobs on Hugging Face infrastructure without local setup.
Install
npx vskill@latest install patchy631/ai-engineering-hub/hugging-face-jobsSKILL.md
Running Workloads on Hugging Face Jobs
Overview
Run any workload on fully managed Hugging Face infrastructure. No local setup required—jobs run on cloud CPUs, GPUs, or TPUs and can persist results to the Hugging Face Hub.
Common use cases:
- Data Processing - Transform, filter, or analyze large datasets
- Batch Inference - Run inference on thousands of samples
- Experiments & Benchmarks - Reproducible ML experiments
- Model Training - Fine-tune models (see
model-trainerskill for TRL-specific training) - Synthetic Data Generation - Generate datasets using LLMs
- Development & Testing - Test code without local GPU setup
- Scheduled Jobs - Automate recurring tasks
For model training specifically: See the model-trainer skill for TRL-based training workflows.
When to Use This Skill
Use this skill when users want to:
- Run Python workloads on cloud infrastructure
- Execute jobs without local GPU/TPU setup
- Process data at scale
- Run batch inference or experiments
- Schedule recurring tasks
- Use GPUs/TPUs for any workload
- Persist results to the Hugging Face Hub
Key Directives
When assisting with jobs:
- ALWAYS use `hf_jobs()` MCP tool - Submit jobs using
hf_jobs("uv", {...})orhf_jobs("run", {...}). 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().
- Always handle authentication - Jobs that interact with the Hub require
HF_TOKENvia secrets. See Token Usage section below.
- Provide job details after submission - After submitting, provide job ID, monitoring URL, estimated time, and note that the user can request status checks later.
- Set appropriate timeouts - Default 30min may be insufficient for long-running tasks.
Prerequisites Checklist
Before starting any 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 Access ⚠️ CRITICAL - Required for any Hub operations (push models/datasets, download private repos, etc.)
- Token must have appropriate permissions (read for downloads, write for uploads)
✅ Token Usage (See Token Usage section for details)
When tokens are required:
- Pushing models/datasets to Hub
- Accessing private repositories
- Using Hub APIs in scripts
- Any authenticated Hub operations
How to provide tokens:
⚠️ CRITICAL: The $HF_TOKEN placeholder is automatically replaced with your logged-in token. Never hardcode tokens in scripts.
Token Usage Guide
Understanding Tokens
What are HF Tokens?
- Authentication credentials for Hugging Face Hub
- Required for authenticated operations (push, private repos, API access)
- Stored securely on your machine after
hf auth login
Token Types:
- Read Token - Can download models/datasets, read private repos
- Write Token - Can push models/datasets, create repos, modify content
- Organization Token - Can act on behalf of an organization
When Tokens Are Required
Always Required:
- Pushing models/datasets to Hub
- Accessing private repositories
- Creating new repositories
- Modifying existing repositories
- Using Hub APIs programmatically
Not Required:
- Downloading public models/datasets
- Running jobs that don't interact with Hub
- Reading public repository information
How to Provide Tokens to Jobs
Method 1: Automatic Token (Recommended)
How it works:
$HF_TOKENis a placeholder that gets replaced with your actual token- Uses the token from your logged-in session (
hf auth login) - Most secure and convenient method
- Token is encrypted server-side when passed as a secret
Benefits:
- No token exposure in code
- Uses your current login session
- Automatically updated if you re-login
- Works seamlessly with MCP tools
Method 2: Explicit Token (Not Recommended)
When to use:
- Only if automatic token doesn't work
- Testing with a specific token
- Organization tokens (use with caution)
Security concerns:
- Token visible in code/logs
- Must manually update if token rotates
- Risk of token exposure
Method 3: Environment Variable (Less Secure)
Difference from secrets:
envvariables are visible in job logssecretsare encrypted server-side- Always prefer
secretsfor tokens
Using Tokens in Scripts
In your Python script, tokens are available as environment variables:
Best practices:
- Don't hardcode tokens in scripts
- Use
os.environ.get("HF_TOKEN")to access - Let
huggingface_hubauto-detect when possible - Verify token exists before Hub operations
Token Verification
Check if you're logged in:
Verify token in job:
Common Token Issues
Error: 401 Unauthorized
- Cause: Token missing or invalid
- Fix: Add
secrets={"HF_TOKEN": "$HF_TOKEN"}to job config - Verify: Check
hf_whoami()works locally
Error: 403 Forbidden
- Cause: Token lacks required permissions
- Fix: Ensure token has write permissions for push operations
- Check: Token type at https://huggingface.co/settings/tokens
Error: Token not found in environment
- Cause:
secretsnot passed or wrong key name - Fix: Use
secrets={"HF_TOKEN": "$HF_TOKEN"}(notenv) - Verify: Script checks
os.environ.get("HF_TOKEN")
Error: Repository access denied
- Cause: Token doesn't have access to private repo
- Fix: Use token from account with access
- Check: Verify repo visibility and your permissions
Token Security Best Practices
- Never commit tokens - Use
$HF_TOKENplaceholder or environment variables - Use secrets, not env - Secrets are encrypted server-side
- Rotate tokens regularly - Generate new tokens periodically
- Use minimal permissions - Create tokens with only needed permissions
- Don't share tokens - Each user should use their own token
- Monitor token usage - Check token activity in Hub settings
Complete Token Example
Quick Start: Two Approaches
Approach 1: UV Scripts (Recommended)
UV scripts use PEP 723 inline dependencies for clean, self-contained workloads.
MCP Tool:
CLI Equivalent:
Python API:
Benefits: Direct MCP tool usage, clean code, dependencies declared inline, no file saving required
When to use: Default choice for all workloads, custom logic, any scenario requiring hf_jobs()
Custom Docker Images for UV Scripts
By default, UV scripts use ghcr.io/astral-sh/uv:python3.12-bookworm-slim. For ML workloads with complex dependencies, use pre-built images:
CLI:
Benefits: Faster startup, pre-installed dependencies, optimized for specific frameworks
Python Version
By default, UV scripts use Python 3.12. Specify a different version:
Python API:
Working with Scripts
⚠️ Important: There are two "script path" stories depending on how you run Jobs:
- Using the `hf_jobs()` MCP tool (recommended in this repo): the
scriptvalue must be inline code (a string) or a URL. A local filesystem path (like"./scripts/foo.py") won't exist inside the remote container. - Using the `hf jobs uv run` CLI: local file paths do work (the CLI uploads your script).
Common mistake with `hf_jobs()` MCP tool:
Correct patterns with `hf_jobs()` MCP tool:
CLI equivalent (local paths supported):
Adding Dependencies at Runtime
Add extra dependencies beyond what's in the PEP 723 header:
Python API:
Approach 2: Docker-Based Jobs
Run jobs with custom Docker images and commands.
MCP Tool:
CLI Equivalent:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinghugging-face-skills/skills/hugging-face-jobs/SKILL.md
Popularity
- Repository stars
- 34,853
- Repository forks
- 5,776
- 7-day trend score
- 52
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 9 May 2026, 5 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/patchy631/ai-engineering-hub/hugging-face-jobs)