Spaces:
Sleeping
Sleeping
a0y0346 Cursor commited on
Commit ·
8dad05f
1
Parent(s): 620fbe1
verify ZeroGPU hardware detection in dummy app
Browse filesAdd GPU name and VRAM reporting to verify runtime detection works.
Co-authored-by: Cursor <cursoragent@cursor.com>
app.py
CHANGED
|
@@ -3,12 +3,20 @@ import spaces
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
zero = torch.Tensor([0]).cuda()
|
| 6 |
-
print(zero.device)
|
| 7 |
|
| 8 |
@spaces.GPU
|
| 9 |
def greet(n):
|
| 10 |
-
print(zero.device)
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
demo = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
demo.launch()
|
|
|
|
| 3 |
import torch
|
| 4 |
|
| 5 |
zero = torch.Tensor([0]).cuda()
|
| 6 |
+
print(zero.device) # <-- 'cpu' on ZeroGPU init
|
| 7 |
|
| 8 |
@spaces.GPU
|
| 9 |
def greet(n):
|
| 10 |
+
print(zero.device) # <-- 'cuda:0' when GPU allocated
|
| 11 |
+
gpu_name = torch.cuda.get_device_name(0)
|
| 12 |
+
vram = torch.cuda.get_device_properties(0).total_mem / (1024**3)
|
| 13 |
+
return f"Hello {zero + n} Tensor | GPU: {gpu_name} | VRAM: {vram:.1f} GB"
|
| 14 |
|
| 15 |
+
demo = gr.Interface(
|
| 16 |
+
fn=greet,
|
| 17 |
+
inputs=gr.Number(label="Input Number"),
|
| 18 |
+
outputs=gr.Text(label="Result"),
|
| 19 |
+
title="Prefix Cache Analyzer (Setup Verification)",
|
| 20 |
+
description="Verifying ZeroGPU allocation and hardware detection.",
|
| 21 |
+
)
|
| 22 |
demo.launch()
|