Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,162 +1,12 @@
|
|
|
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: indigo
|
| 6 |
-
sdk:
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
-
<div style="height: 15px;"></div>
|
| 10 |
-
|
| 11 |
-
# ZeroGPU Spaces
|
| 12 |
-
|
| 13 |
-
<div class="not-prose bg-gradient-to-r from-gray-50-to-white text-gray-900 border" style="border-radius: 8px; padding: 0.5rem 1rem; margin-bottom: 10px;">
|
| 14 |
-
<span style="font-weight: 600;">🚨 This page is out of date:</span> for up-to-date information, see <a class="underline" target="_blank" href="https://huggingface.co/docs/hub/spaces-zerogpu" style="color: inherit;">the documentation</a>.
|
| 15 |
-
</div>
|
| 16 |
-
|
| 17 |
-
<div class="not-prose bg-gradient-to-r from-gray-50-to-white text-gray-900 border" style="border-radius: 8px; padding: 0.5rem 1rem; margin-bottom: 10px;">
|
| 18 |
-
<span style="font-weight: 600;">✨ September 2025</span>: checkout this new <a class="underline" target="_blank" href="https://huggingface.co/blog/zerogpu-aoti" style="color: inherit;">blogpost</a> about ZeroGPU and compilation.
|
| 19 |
-
</div>
|
| 20 |
-
|
| 21 |
-
<div class="not-prose bg-gradient-to-r from-gray-50-to-white text-gray-900 border" style="border-radius: 8px; padding: 0.5rem 1rem;">
|
| 22 |
-
<span style="font-weight: 600;">ZeroGPU is currently in beta:</span>
|
| 23 |
-
<ul class="list-disc list-inside pl-8">
|
| 24 |
-
<li>It's available for everyone to use for free: <a class="underline" target="_blank" href="https://huggingface.co/spaces/enzostvs/zero-gpu-spaces">Browse dedicated Spaces list</a>.</li>
|
| 25 |
-
<li>Hosting ZeroGPU Spaces is available for <a class="underline" target="_blank" href="https://huggingface.co/subscribe/pro">PRO</a> users or <a class="underline" target="_blank" href="https://huggingface.co/enterprise">Enterprise</a> organizations.</li>
|
| 26 |
-
<li><a class="underline" target="_blank" href="https://huggingface.co/subscribe/pro">PRO</a> users also get x5 more daily usage quota and highest priority in GPU queues when using any ZeroGPU Spaces.</li>
|
| 27 |
-
</ul>
|
| 28 |
-
</div>
|
| 29 |
-
|
| 30 |
-
<div class="not-prose bg-gradient-to-r from-gray-50-to-white text-gray-900 border" style="border-radius: 8px; padding: 0.5rem 1rem; margin-top: 10px;">
|
| 31 |
-
<span style="font-weight: 600;">Please share your feedback about ZeroGPU</span> in the <a class="underline" target="_blank" href="https://huggingface.co/spaces/zero-gpu-explorers/README/discussions" style="color: inherit;">Community tab</a>.
|
| 32 |
-
</div>
|
| 33 |
-
|
| 34 |
-
<div class="not-prose bg-gradient-to-r from-gray-50-to-white text-gray-900 border" style="border-radius: 8px; padding: 0.5rem 1rem; margin-top: 10px;">
|
| 35 |
-
<span style="font-weight: 600;">ZeroGPU works great with Dev Mode.</span> Learn more about <a target="_blank" href="https://huggingface.co/spaces/dev-mode-explorers/README" class="underline">Dev Mode</a>.
|
| 36 |
-
</div>
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
<img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/cAlvAOu9QC547zrmRVpS5.gif" style="width: 100%; max-width:950px"/>
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
*ZeroGPU* is a new kind of hardware for Spaces.
|
| 44 |
-
|
| 45 |
-
It has two goals :
|
| 46 |
-
- Provide **free GPU access** for Spaces
|
| 47 |
-
- Allow Spaces to run on **multiple GPUs**
|
| 48 |
-
|
| 49 |
-
This is achieved by making Spaces efficiently hold and release GPUs as needed
|
| 50 |
-
(as opposed to a classical GPU Space that holds exactly one GPU at any point in time)
|
| 51 |
-
|
| 52 |
-
ZeroGPU uses _Nvidia H200_ GPU devices under the hood (70GB of vRAM are available for each workload)
|
| 53 |
-
|
| 54 |
-
<img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/naVZI-v41zNxmGlhEhGDJ.gif" style="width: 100%; max-width:550px"/>
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
## Compatibility
|
| 58 |
-
|
| 59 |
-
*ZeroGPU* Spaces should mostly be compatible with any PyTorch-based GPU Space.<br>
|
| 60 |
-
Compatibility with high level HF libraries like `transformers` or `diffusers` is slightly more guaranteed<br>
|
| 61 |
-
That said, ZeroGPU Spaces are not as broadly compatible as classical GPU Spaces and you might still encounter unexpected bugs
|
| 62 |
-
|
| 63 |
-
Also, for now, ZeroGPU Spaces only works with the **Gradio SDK**
|
| 64 |
-
|
| 65 |
-
Supported versions:
|
| 66 |
-
- Gradio: 4+
|
| 67 |
-
- PyTorch: `2.1.2` to `2.5.1` (2.3.x is not supported due to a PyToch [bug](https://github.com/pytorch/pytorch/issues/122085))
|
| 68 |
-
- Python: `3.10.13`
|
| 69 |
-
|
| 70 |
-
## Usage
|
| 71 |
-
|
| 72 |
-
In order to make your Space work with ZeroGPU you need to **decorate** the Python functions that actually require a GPU with `@spaces.GPU`<br>
|
| 73 |
-
During the time when a decorated function is invoked, the Space will be attributed a GPU, and it will release it upon completion of the function.<br>
|
| 74 |
-
Here is a practical example :
|
| 75 |
-
|
| 76 |
-
```diff
|
| 77 |
-
+import spaces
|
| 78 |
-
from diffusers import DiffusionPipeline
|
| 79 |
-
|
| 80 |
-
pipe = DiffusionPipeline.from_pretrained(...)
|
| 81 |
-
pipe.to('cuda')
|
| 82 |
-
|
| 83 |
-
+@spaces.GPU
|
| 84 |
-
def generate(prompt):
|
| 85 |
-
return pipe(prompt).images
|
| 86 |
-
|
| 87 |
-
gr.Interface(
|
| 88 |
-
fn=generate,
|
| 89 |
-
inputs=gr.Text(),
|
| 90 |
-
outputs=gr.Gallery(),
|
| 91 |
-
).launch()
|
| 92 |
-
```
|
| 93 |
-
|
| 94 |
-
1. We first `import spaces` (importing it first might prevent some issues but is not mandatory)
|
| 95 |
-
2. Then we decorate the `generate` function by adding a `@spaces.GPU` line before its definition
|
| 96 |
-
|
| 97 |
-
Note that `@spaces.GPU` is effect-free and can be safely used on non-ZeroGPU environments
|
| 98 |
-
|
| 99 |
-
## Duration
|
| 100 |
-
|
| 101 |
-
If you expect your GPU function to take more than __60s__ then you need to specify a `duration` param in the decorator like:
|
| 102 |
-
|
| 103 |
-
```python
|
| 104 |
-
@spaces.GPU(duration=120)
|
| 105 |
-
def generate(prompt):
|
| 106 |
-
return pipe(prompt).images
|
| 107 |
-
```
|
| 108 |
-
|
| 109 |
-
It will set the maximum duration of your function call to 120s.
|
| 110 |
-
You can also specify a duration if you know that your function will take far less than the 60s default.
|
| 111 |
-
The lower the duration, the higher priority your Space visitors will have in the queue
|
| 112 |
-
|
| 113 |
-
## Getting Started
|
| 114 |
-
|
| 115 |
-
To **explore and use existing ZeroGPU Spaces**, browse the following list: https://huggingface.co/spaces/enzostvs/zero-gpu-spaces
|
| 116 |
-
|
| 117 |
-
To **create and host your own ZeroGPU Spaces**:
|
| 118 |
-
|
| 119 |
-
- For personal accounts:
|
| 120 |
-
- <a href="https://huggingface.co/settings/billing/subscription" target="_blank">Subscribe to PRO</a>. Once subscribed, ZeroGPU will appear in the hardware list on <a href="https://huggingface.co/new-space" target="_blank">New Space page</a> when you select the Gradio SDK.
|
| 121 |
-
- For organizations:
|
| 122 |
-
- <a href="https://huggingface.co/enterprise" target="_blank">Subscribe to the Enterprise Hub</a>. This will enable you to host and collaborate on ZeroGPU Spaces with all your organization members.
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
## Limitations
|
| 126 |
-
|
| 127 |
-
**Personal accounts** (PRO subscribers) can host up to 10 ZeroGPU Spaces.
|
| 128 |
-
|
| 129 |
-
**Organization accounts** subscribed to the Enterprise Hub can host up to 50 ZeroGPU Spaces.
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
<div style="height: 35px;"></div>
|
| 133 |
-
<style>
|
| 134 |
-
:root {
|
| 135 |
-
--bg-color-light: rgba(255, 255, 255, 0.3);
|
| 136 |
-
--bg-color-dark: rgba(0, 0, 0, 0.3);
|
| 137 |
-
--text-color-light: rgb(0, 0, 0);
|
| 138 |
-
--text-color-dark: rgb(255, 255, 255);
|
| 139 |
-
}
|
| 140 |
-
|
| 141 |
-
.theme-light {
|
| 142 |
-
--bg-color: var(--bg-color-light);
|
| 143 |
-
--text-color: var(--text-color-light);
|
| 144 |
-
}
|
| 145 |
-
|
| 146 |
-
.theme-dark {
|
| 147 |
-
--bg-color: var(--bg-color-dark);
|
| 148 |
-
--text-color: var(--text-color-dark);
|
| 149 |
-
}
|
| 150 |
-
|
| 151 |
-
.notice {
|
| 152 |
-
background-color: var(--bg-color);
|
| 153 |
-
color: var(--text-color);
|
| 154 |
-
border-radius: 8px;
|
| 155 |
-
padding: 0.5rem 1rem;
|
| 156 |
-
margin-top: 10px;
|
| 157 |
-
}
|
| 158 |
|
| 159 |
-
.notice span {
|
| 160 |
-
font-weight: 600;
|
| 161 |
-
}
|
| 162 |
-
</style>
|
|
|
|
| 1 |
+
|
| 2 |
---
|
| 3 |
+
title: Performance Platform
|
| 4 |
+
emoji: 📊
|
| 5 |
+
colorFrom: blue
|
| 6 |
colorTo: indigo
|
| 7 |
+
sdk: gradio
|
| 8 |
+
sdk_version: 5.49.1
|
| 9 |
+
python_version: 3.10
|
| 10 |
+
app_file: app.py
|
| 11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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