huggingface-zerogpu
Что он делает
Этот инструмент позволяет запускать ИИ-демонстрации, которым нужна мощность GPU. Он эффективно управляет доступом к GPU, чтобы вы могли запускать ИИ-модели без мощной видеокарты на своем компьютере.
Когда использовать
- ✓Когда вы хотите показать другим, как работает ИИ-модель.
- ✓Когда вашему ИИ-коду нужен GPU для быстрой работы, а своего GPU у вас нет.
- ✓Когда вы настраиваете ИИ-проект, который использует определенные возможности GPU.
Ссылка на скилл
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/huggingface-zerogpu/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Как сделать так, чтобы моя ИИ-модель использовала GPU и работала быстрее?”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Инструмент настраивает ваш код на использование удаленных GPU. Он следит за тем, чтобы часть кода, работающая с GPU, запускалась только тогда, когда это нужно, и управляет передачей данных на GPU.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Hugging Face ZeroGPU
When to Use
Use this skill when you need aI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU. Use when writing or reviewing code that uses @spaces.GPU, configuring python_version or requirements.txt for a ZeroGPU Space, or handling ZeroGPU-specific code constraints — pickle-based process...
Rules and patterns for ML demos on Hugging Face Spaces with ZeroGPU hardware. Covers @spaces.GPU, duration and quota tuning, process isolation, the CUDA availability model, concurrency safety, and CUDA build constraints.
Scope
This skill is for Gradio SDK Spaces using ZeroGPU hardware. Docker and Static Spaces cannot schedule onto ZeroGPU, and Streamlit apps now run as Docker Spaces — so this skill applies only to Gradio. For general Gradio coding (components, layouts, event listeners), see the huggingface-gradio skill in this repo. The authoritative ZeroGPU docs live at https://huggingface.co/docs/hub/spaces-zerogpu — refer to them for the current backing GPU, runtime version lists, and tier thresholds, all of which change over time.
Reference Files
| Reference | When to read |
|---|---|
references/concurrency.md |
Always read alongside SKILL.md when writing ZeroGPU code — handlers run in parallel by default |
references/how-zerogpu-works.md |
When reasoning about cold-starts, worker reuse, why module-scope warmup does not carry to requests, or why returning CUDA tensors hangs |
references/how-quota-works.md |
When choosing duration values, debugging illegal duration vs quota exceeded errors, or explaining why default 60s blocks short tasks |
references/cuda-and-deps.md |
When installing CUDA-dependent packages (e.g. flash-attn), pinning torch side-cars, or reading wheel filename tags |
Hardware
ZeroGPU exposes two GPU sizes that map to a fraction of the backing card:
size |
Slice of backing GPU | Quota cost |
|---|---|---|
large (default) |
Half | 1x |
xlarge |
Full | 2x |
Default large gives half a physical GPU, so memory bandwidth and compute are significantly lower than the full card's specs. Use xlarge only when the workload genuinely needs the extra memory or compute.
Backing GPU changes without notice. ZeroGPU has already migrated across GPU generations several times; older write-ups may name A100 or H200, but those are outdated. For the current backing GPU and exact per-size VRAM, always check the ZeroGPU docs before sizing workloads.
Basic Pattern
import spaces
import torch
from transformers import pipeline
pipe = pipeline("text-generation", model="...", device="cuda")
@spaces.GPU
def generate(prompt: str) -> str:
return pipe(prompt, max_new_tokens=100)[0]["generated_text"]
Key rules:
- Instantiate models at module scope and call
.to("cuda")eagerly. ZeroGPU handles the actual device mapping transparently (see CUDA availability model below). - Decorate GPU functions with
@spaces.GPU. The decorator is a no-op outside ZeroGPU, so it is safe to keep in all environments. - Set
durationto match the realistic worst-case workload (default 60s). The platform pre-checksrequested durationagainst the user'sremaining quota— not against the actual run time — so a 10-second task left at the 60s default fails withquota exceededas soon as the user's remaining quota drops below 60s. Smaller declareddurationalso ranks higher in the node-level queue. See "Duration and Quota" below. torch.compileis NOT supported. Use PyTorch ahead-of-time compilation (AoTI) (torch 2.8+) instead.- Use
size="xlarge"sparingly. It allocates the full backing GPU, but costs 2x quota and tends to queue longer.
@spaces.GPU(duration=120)
def generate_image(prompt: str):
return pipe(prompt).images[0]
CUDA Availability Model
Real GPU access is only available inside @spaces.GPU-decorated functions. Outside those functions, the GPU is not attached to the process.
However, import spaces monkey-patches torch so that:
torch.cuda.is_available()returnsTrueglobally..to("cuda")/device="cuda"calls at module scope succeed without error.
…
Частые вопросы
Что такое ZeroGPU?
ZeroGPU это система, которая позволяет использовать мощные GPU без владения ими. Она управляет доступом к этим GPU для запуска ИИ-приложений.
Можно ли использовать это с любым ИИ-приложением?
Этот инструмент предназначен для приложений, созданных в Gradio Spaces, которым нужен GPU. Другие типы проектов могут не работать.
Почему мой код не работает вне функции с декоратором @spaces.GPU?
GPU по-настоящему доступен только внутри функций, помеченных @spaces.GPU. Вне их инструмент имитирует доступ, чтобы подготовить код, но тяжелые вычисления выполняются только в нужном месте.
Подробности
Оригинальное описание автора
AI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU.
Популярность
- Звёзды на GitHub
- 48k
- Место в рейтинге
- #4851
- Лицензия
- MIT
- Обновлён
- 15.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
00-andruia-consultant
48kПомогает агенту начинать или улучшать ИИ-проекты: анализирует код, подбирает инструменты и составляет план на испанском.
007
48kАгент проводит аудит безопасности и моделирование угроз для защиты проектов.
10-andruia-skill-smith
48kПомогает агенту создавать и улучшать ИИ-инструменты: описание работы, документация и проверка структуры.
20-andruia-niche-intelligence
48kАгент составляет обзор отрасли: контекст, правила, паттерны использования и риски по надёжным источникам.
Похожие скиллы
add-model-provider
394kПомогает агенту подключить нового провайдера ИИ-моделей к OpenClaw безопасными командами, хранить ключи API не в открытом виде и провести живой тест.
acp-router
394kПомогает агенту передать задачу инструменту для программирования, например Claude Code или Cursor, через OpenClaw, чтобы работа шла в этом инструменте.
browser-automation
394kУчит агента пошагово управлять веб-страницами: входить в аккаунты, работать с вкладками и восстанавливаться, если страница перестала отвечать.