Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
a092fd7
1
Parent(s):
8640a78
Add debugging info and Zero GPU hardware suggestion
Browse files- Add GPU availability debug prints
- Show GPU name and memory when available
- Add note about Zero GPU settings when running on CPU
- Add suggested_hardware: zero-a10g in README.md
- This helps diagnose why GPU is not being allocated
README.md
CHANGED
@@ -8,6 +8,7 @@ sdk_version: 5.34.2
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
11 |
models:
|
12 |
- PascalNotin/Tranception_Small
|
13 |
- PascalNotin/Tranception_Medium
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
+
suggested_hardware: zero-a10g
|
12 |
models:
|
13 |
- PascalNotin/Tranception_Small
|
14 |
- PascalNotin/Tranception_Medium
|
app.py
CHANGED
@@ -268,16 +268,21 @@ def score_and_create_matrix_all_singles_impl(sequence,mutation_range_start=None,
|
|
268 |
model = tranception.model_pytorch.TranceptionLMHeadModel.from_pretrained(pretrained_model_name_or_path=model_path)
|
269 |
|
270 |
# Device selection - Zero GPU will provide CUDA when decorated with @spaces.GPU
|
|
|
271 |
if torch.cuda.is_available():
|
272 |
device = torch.device("cuda")
|
273 |
model = model.to(device)
|
274 |
-
|
|
|
|
|
|
|
275 |
# Increase batch size for GPU inference
|
276 |
batch_size_inference = min(batch_size_inference, 50)
|
277 |
else:
|
278 |
device = torch.device("cpu")
|
279 |
model = model.to(device)
|
280 |
print("Inference will take place on CPU")
|
|
|
281 |
# Reduce batch size for CPU inference
|
282 |
batch_size_inference = min(batch_size_inference, 10)
|
283 |
|
|
|
268 |
model = tranception.model_pytorch.TranceptionLMHeadModel.from_pretrained(pretrained_model_name_or_path=model_path)
|
269 |
|
270 |
# Device selection - Zero GPU will provide CUDA when decorated with @spaces.GPU
|
271 |
+
print(f"GPU Available: {torch.cuda.is_available()}")
|
272 |
if torch.cuda.is_available():
|
273 |
device = torch.device("cuda")
|
274 |
model = model.to(device)
|
275 |
+
gpu_name = torch.cuda.get_device_name(0)
|
276 |
+
gpu_memory = torch.cuda.get_device_properties(0).total_memory / 1024**3
|
277 |
+
print(f"Inference will take place on {gpu_name}")
|
278 |
+
print(f"GPU Memory: {gpu_memory:.2f} GB")
|
279 |
# Increase batch size for GPU inference
|
280 |
batch_size_inference = min(batch_size_inference, 50)
|
281 |
else:
|
282 |
device = torch.device("cpu")
|
283 |
model = model.to(device)
|
284 |
print("Inference will take place on CPU")
|
285 |
+
print("Note: If you expected GPU, ensure Zero GPU is enabled in Space settings")
|
286 |
# Reduce batch size for CPU inference
|
287 |
batch_size_inference = min(batch_size_inference, 10)
|
288 |
|