मुख्य सामग्री पर जाएँ
Skillpedia
एजेंट48k · #4851

huggingface-zerogpu

यह क्या करती है

यह टूल ऐसे AI डेमो चलाने देता है जिन्हें GPU की ताकत चाहिए। यह GPU की पहुँच को कुशलता से मैनेज करता है, ताकि आपके अपने कंप्यूटर पर शक्तिशाली GPU न होने पर भी AI मॉडल चल सकें।

कब इस्तेमाल करें

  • ✓जब आप किसी AI मॉडल को काम करते हुए दूसरों को दिखाना चाहते हैं।
  • ✓जब आपके AI कोड को तेज़ी से चलने के लिए GPU चाहिए, लेकिन आपके पास GPU नहीं है।
  • ✓जब आप किसी AI प्रोजेक्ट को सेट कर रहे हों जिसमें GPU की खास सुविधाएँ इस्तेमाल होती हैं।

Skill का लिंक

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/huggingface-zerogpu/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/huggingface-zerogpu/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरा AI मॉडल तेज़ी से चलने के लिए GPU का इस्तेमाल कैसे करे?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

टूल आपके कोड को remote GPUs इस्तेमाल करने के लिए कॉन्फ़िगर करता है। यह सुनिश्चित करता है कि कोड का 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:

  1. Instantiate models at module scope and call .to("cuda") eagerly. ZeroGPU handles the actual device mapping transparently (see CUDA availability model below).
  2. Decorate GPU functions with @spaces.GPU. The decorator is a no-op outside ZeroGPU, so it is safe to keep in all environments.
  3. Set duration to match the realistic worst-case workload (default 60s). The platform pre-checks requested duration against the user's remaining quota — not against the actual run time — so a 10-second task left at the 60s default fails with quota exceeded as soon as the user's remaining quota drops below 60s. Smaller declared duration also ranks higher in the node-level queue. See "Duration and Quota" below.
  4. torch.compile is NOT supported. Use PyTorch ahead-of-time compilation (AoTI) (torch 2.8+) instead.
  5. 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() returns True globally.
  • .to("cuda") / device="cuda" calls at module scope succeed without error.

…

अक्सर पूछे जाने वाले सवाल

'ZeroGPU' क्या है?

ZeroGPU एक ऐसा सिस्टम है जिससे आप बिना खुद का GPU खरीदे शक्तिशाली GPUs इस्तेमाल कर सकते हैं। यह AI एप्लिकेशन चलाने के लिए इन GPUs तक पहुँच को मैनेज करता है।

क्या मैं इसे किसी भी तरह की AI एप्लिकेशन के साथ इस्तेमाल कर सकता हूँ?

यह टूल खास तौर पर उन Gradio Spaces एप्लिकेशन के लिए है जिन्हें GPU चाहिए। दूसरे तरह के प्रोजेक्ट शायद काम न करें।

मेरा कोड `@spaces.GPU` से चिह्नित function के बाहर क्यों नहीं चलता?

GPU असल में सिर्फ़ उन functions के अंदर उपलब्ध होता है जिन्हें `@spaces.GPU` से चिह्नित किया गया है। उनके बाहर टूल कोड तैयार करने के लिए GPU की पहुँच का नकली रूप देता है, लेकिन भारी गणना सिर्फ़ सही जगह पर होती है।

जानकारी

लेखक का मूल विवरण

AI demos and GPU compute with Gradio Spaces and Hugging Face Spaces ZeroGPU.

repo: sickn33/agentic-awesome-skills

लोकप्रियता

GitHub स्टार
48k
रैंकिंग में स्थान
#4851
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

00-andruia-consultant

48k

आपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।

AI और एजेंटएजेंट

007

48k

आपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।

कोडिंगसिक्योरिटी

10-andruia-skill-smith

48k

आपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।

AI और एजेंटएजेंट

20-andruia-niche-intelligence

48k

आपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।

लेखन और डॉक्यूमेंटरिसर्च

मिलती-जुलती skills