SKILL

huggingface-zerogpu

使用Gradio Spaces和Hugging Face Spaces ZeroGPU进行AI演示与GPU计算。当编写或审查使用`@spaces.GPU`的代码、为ZeroGPU Space配置`python_version`或`requirements.txt`,或处理ZeroGPU特有的代码约束时使用——基于pickle的进程隔离、跨工作进程边界的`gr.State`语义、不支持`torch.compile`(改用AoTI)、仅CUDA wheel构建(构建或运行时均无`nvcc`)、large与xlarge规格选择,以及动态时长可调用对象。只要用户提到ZeroGPU、`@spaces.GPU`或`spaces` Python包,或遇到ZeroGPU特有的代码错误(如跨工作进程边界的`PicklingError`、`illegal duration`或`flash-attn` wheel构建失败),务必使用此技能——即使用户未明确要求ZeroGPU编码指导。当代码中出现`import spaces`或`@spaces.GPU`时触发。

机器翻译
查看英文原文

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 isolation, `gr.State` semantics across the worker boundary, no `torch.compile` (use AoTI instead), CUDA wheel-only builds (no `nvcc` at build or runtime), large vs xlarge sizing, and dynamic duration callables. Make sure to use this skill whenever the user mentions ZeroGPU, `@spaces.GPU`, or the `spaces` Python package, or hits ZeroGPU-specific code errors like `PicklingError` across the worker boundary, `illegal duration`, or `flash-attn` wheel-build failures — even when the user does not explicitly ask for ZeroGPU coding guidance. Trigger on `import spaces` or `@spaces.GPU` in code.

适用对象:软件开发与测试。自动收录 · 待核查。

原作者说明节选

从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。

查看英文原文

原文涵盖的主题

  • Hugging Face ZeroGPU
  • Scope
  • Reference Files
  • Hardware
  • Basic Pattern
  • CUDA Availability Model
  • Device selection idiom still works
  • Eager loading is the right default

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. 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 | 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 e

这里只展示节选,请以完整原文和当前要求为准。

来源仓库
huggingface/skills
源文件
skills/huggingface-zerogpu/SKILL.md
固定版本
25910b3d0ba31a2ba102f901cdc9e008c278a69c
阅读完整原作者说明 ↗

来源与内容状态

本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。

原作者:huggingface/skills · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T16:01:02.765Z。

分类由名称、说明与路径规则生成,分类不代表已核实适配。

许可与权利归属

Apache-2.0。第三方内容及版权归原作者,使用条件以原文为准。

许可原文 ↗

本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。

限制与注意事项

  • 元数据收录不代表本站已经安装、适配、实测或进行安全审查。