Spaces:
Sleeping
Sleeping
Commit
·
5ee455a
1
Parent(s):
75aac04
Fix UnboundLocalError: remove duplicate torch import
Browse files
app.py
CHANGED
|
@@ -224,7 +224,6 @@ def load_vllm_model(model_name: str):
|
|
| 224 |
# Force torch to reinitialize CUDA context after changing CUDA_VISIBLE_DEVICES
|
| 225 |
# This ensures vLLM sees the correct device
|
| 226 |
try:
|
| 227 |
-
import torch
|
| 228 |
if hasattr(torch.cuda, '_lazy_init'):
|
| 229 |
torch.cuda._lazy_init()
|
| 230 |
except Exception:
|
|
@@ -232,7 +231,6 @@ def load_vllm_model(model_name: str):
|
|
| 232 |
|
| 233 |
# Force torch to see the correct device after setting CUDA_VISIBLE_DEVICES
|
| 234 |
# This ensures vLLM's device detection works correctly
|
| 235 |
-
import torch
|
| 236 |
if torch.cuda.is_available():
|
| 237 |
# Verify device is accessible
|
| 238 |
device_name = torch.cuda.get_device_name(0)
|
|
|
|
| 224 |
# Force torch to reinitialize CUDA context after changing CUDA_VISIBLE_DEVICES
|
| 225 |
# This ensures vLLM sees the correct device
|
| 226 |
try:
|
|
|
|
| 227 |
if hasattr(torch.cuda, '_lazy_init'):
|
| 228 |
torch.cuda._lazy_init()
|
| 229 |
except Exception:
|
|
|
|
| 231 |
|
| 232 |
# Force torch to see the correct device after setting CUDA_VISIBLE_DEVICES
|
| 233 |
# This ensures vLLM's device detection works correctly
|
|
|
|
| 234 |
if torch.cuda.is_available():
|
| 235 |
# Verify device is accessible
|
| 236 |
device_name = torch.cuda.get_device_name(0)
|