huggingface-zerogpu
Has your agent create AI demos with graphics computing power. It's useful for running demos online without needing powerful hardware.
What it does
This tool lets you run AI demonstrations that need GPU processing power. It efficiently manages access to GPUs so you can run AI models without needing a powerful GPU on your own computer.
When to use it
- ✓When you want to show an AI model working to others.
- ✓When your AI code needs a GPU to run fast, but you don't have one.
- ✓When setting up an AI project that uses specific GPU features.
Example of what to ask your AI
“How can I make my AI model use the GPU to run faster?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The tool configures your code to use remote GPUs. It ensures that the part of your code using the GPU only runs when needed and manages how data is sent to the GPU.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill huggingface-zerogpuOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/huggingface-zerogpu/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from 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.
…
FAQ
What is 'ZeroGPU'?
ZeroGPU is a system that allows you to use powerful GPUs without physically owning one. It manages access to these GPUs for running AI applications.
Can I use this with any type of AI application?
This tool is specific to applications built with Gradio Spaces that require a GPU. Other project types might not work.
Why doesn't my code run outside the function decorated with @spaces.GPU?
The GPU is only truly available inside functions marked with @spaces.GPU. Outside of them, the tool simulates access to prepare the code, but the heavy computation only happens in the correct place.
Details
Original description by the author
AI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU.
Popularity
- GitHub stars
- 48k
- Ranking position
- #3237
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
agent-architecture-audit
Makes your agent check if everything is working correctly. It finds and fixes problems in AI systems, ensuring they perform as expected.
affaan-m/ECC
agent-eval
Helps your agent compare different AI coding tools. It measures which one is faster, cheaper, and more reliable for specific tasks.
affaan-m/ECC
agent-harness-construction
Makes your agent better understand how to perform tasks. It optimizes the tools and instructions the agent uses to increase its chances of success.
affaan-m/ECC