Chuyển đến nội dung
Skillpedia
Agent48k · #4838

hugging-face-jobs

Skill này làm gì

Công cụ này cho phép bạn chạy các tác vụ lập trình (script Python) trên máy tính đám mây mạnh mẽ mà không cần cài đặt gì trên máy của bạn. Nó có thể dùng các tài nguyên như GPU để làm việc nhanh hơn.

Khi nào nên dùng

  • ✓Khi bạn cần chạy một script Python đòi hỏi nhiều sức mạnh tính toán.
  • ✓Khi muốn xử lý khối lượng dữ liệu lớn mà không làm quá tải máy của bạn.
  • ✓Khi muốn chạy các tác vụ lặp lại hoặc theo lịch trên đám mây.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-jobs/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugging-face-jobs/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chạy script Python của tôi để huấn luyện mô hình học máy này bằng GPU.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Bạn gửi code Python của mình, và công cụ thực thi nó trên các máy chủ từ xa. Công cụ lo toàn bộ phần thiết lập và có thể dùng phần cứng chuyên dụng như GPU để tăng tốc.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Running Workloads on Hugging Face Jobs

Detailed Guide

Read the detailed guide 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:

  • 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

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:

# hf_jobs MCP tool — $HF_TOKEN is auto-replaced with real token:
{"secrets": {"HF_TOKEN": "$HF_TOKEN"}}

# HfApi().run_uv_job() — MUST pass actual token:
from huggingface_hub import get_token
secrets={"HF_TOKEN": get_token()}

⚠️ CRITICAL: The $HF_TOKEN placeholder is ONLY auto-replaced by the hf_jobs MCP tool. When using HfApi().run_uv_job(), you MUST pass the real token via get_token(). Passing the literal string "$HF_TOKEN" results in a 9-character invalid token and 401 errors.

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)

hf_jobs("uv", {
    "script": "your_script.py",
    "secrets": {"HF_TOKEN": "$HF_TOKEN"}  # ✅ Automatic replacement
})

How it works:

  • $HF_TOKEN is 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)

hf_jobs("uv", {
    "script": "your_script.py",
    "secrets": {"HF_TOKEN": "hf_abc123..."}  # ⚠️ Hardcoded token
})

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)

hf_jobs("uv", {
    "script": "your_script.py",
    "env": {"HF_TOKEN": "hf_abc123..."}  # ⚠️ Less secure than secrets
})

Difference from secrets:

  • env variables are visible in job logs
  • secrets are encrypted server-side
  • Always prefer secrets for tokens

Using Tokens in Scripts

In your Python script, tokens are available as environment variables:

# /// script
# dependencies = ["huggingface-hub"]
# ///

import os
from huggingface_hub import HfApi

# Token is automatically available if passed via secrets
token = os.environ.get("HF_TOKEN")


…
Câu hỏi thường gặp

Tôi có phải trả tiền để dùng không?

Có, công cụ này yêu cầu gói Hugging Face trả phí (Pro, Team hoặc Enterprise) để hoạt động.

“Token” là gì và tại sao tôi cần chúng?

Token giống như mật khẩu bí mật chứng minh bạn là ai với Hugging Face. Chúng cần để truy cập dữ liệu của bạn hoặc gửi kết quả trở lại nền tảng.

Script biết dùng token nào?

Cách an toàn nhất là dùng code đặc biệt tự động lấy token từ tài khoản đã đăng nhập của bạn. Tránh viết trực tiếp token vào code.

Chi tiết

Mô tả gốc của tác giả

Run workloads on Hugging Face Jobs with managed CPUs, GPUs, TPUs, secrets, and Hub persistence.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4838
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự