Spaces:
Paused
Paused
Ahmet Kaan Sever
commited on
Commit
·
6d65a79
1
Parent(s):
04b81d8
New gpu response for gpu packets with multiple gpus
Browse files- svc/router.py +14 -10
svc/router.py
CHANGED
@@ -53,6 +53,7 @@ async def deep_eval_status():
|
|
53 |
@router.get("/deepeval/hardware")
|
54 |
def hardware_status():
|
55 |
info = get_gpu_tier()
|
|
|
56 |
return info
|
57 |
|
58 |
@router.post("/chat", response_model=TaskResponse)
|
@@ -155,17 +156,20 @@ def get_gpu_tier():
|
|
155 |
if not torch.cuda.is_available():
|
156 |
return {"gpu": "CPU", "tier": "cpu"}
|
157 |
|
158 |
-
|
|
|
159 |
|
160 |
-
#
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
return {"gpu": "Tesla T4", "tier": "t4-medium"}
|
164 |
-
elif "
|
165 |
-
return {"gpu": "NVIDIA L4", "tier": "l4x1"}
|
166 |
-
elif "l40s" in gpu_name:
|
167 |
-
return {"gpu": "NVIDIA L40S", "tier": "l40sx1"}
|
168 |
-
elif "a10g" in gpu_name:
|
169 |
return {"gpu": "NVIDIA A10G", "tier": "a10g"}
|
170 |
else:
|
171 |
-
return {"gpu":
|
|
|
53 |
@router.get("/deepeval/hardware")
|
54 |
def hardware_status():
|
55 |
info = get_gpu_tier()
|
56 |
+
print("Hardware Response:", info)
|
57 |
return info
|
58 |
|
59 |
@router.post("/chat", response_model=TaskResponse)
|
|
|
156 |
if not torch.cuda.is_available():
|
157 |
return {"gpu": "CPU", "tier": "cpu"}
|
158 |
|
159 |
+
device_count = torch.cuda.device_count()
|
160 |
+
gpu_names = [torch.cuda.get_device_name(i).lower() for i in range(device_count)]
|
161 |
|
162 |
+
# Count how many of each GPU type we care about
|
163 |
+
l4_count = sum("l4" in name and "l40s" not in name for name in gpu_names)
|
164 |
+
l40s_count = sum("l40s" in name for name in gpu_names)
|
165 |
+
|
166 |
+
if l4_count == device_count:
|
167 |
+
return {"gpu": "NVIDIA L4", "tier": f"l4x{l4_count}"}
|
168 |
+
elif l40s_count == device_count:
|
169 |
+
return {"gpu": "NVIDIA L40S", "tier": f"l40sx{l40s_count}"}
|
170 |
+
elif "t4" in gpu_names[0]:
|
171 |
return {"gpu": "Tesla T4", "tier": "t4-medium"}
|
172 |
+
elif "a10g" in gpu_names[0]:
|
|
|
|
|
|
|
|
|
173 |
return {"gpu": "NVIDIA A10G", "tier": "a10g"}
|
174 |
else:
|
175 |
+
return {"gpu": gpu_names[0], "tier": "unknown"}
|