mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
Add GPU type information to health check response
- Updated the health check endpoint to include the type of GPU available (CUDA or MPS). - Modified the HealthResponse model to accommodate the new gpu_type field, enhancing the response with detailed GPU information. - This change improves the clarity of system capabilities for users and developers.
This commit is contained in:
@@ -79,6 +79,12 @@ async def health():
|
|||||||
has_mps = hasattr(torch.backends, 'mps') and torch.backends.mps.is_available()
|
has_mps = hasattr(torch.backends, 'mps') and torch.backends.mps.is_available()
|
||||||
gpu_available = has_cuda or has_mps
|
gpu_available = has_cuda or has_mps
|
||||||
|
|
||||||
|
gpu_type = None
|
||||||
|
if has_cuda:
|
||||||
|
gpu_type = f"CUDA ({torch.cuda.get_device_name(0)})"
|
||||||
|
elif has_mps:
|
||||||
|
gpu_type = "MPS (Apple Silicon)"
|
||||||
|
|
||||||
vram_used = None
|
vram_used = None
|
||||||
if has_cuda:
|
if has_cuda:
|
||||||
vram_used = torch.cuda.memory_allocated() / 1024 / 1024 # MB
|
vram_used = torch.cuda.memory_allocated() / 1024 / 1024 # MB
|
||||||
@@ -136,6 +142,7 @@ async def health():
|
|||||||
model_downloaded=model_downloaded,
|
model_downloaded=model_downloaded,
|
||||||
model_size=model_size,
|
model_size=model_size,
|
||||||
gpu_available=gpu_available,
|
gpu_available=gpu_available,
|
||||||
|
gpu_type=gpu_type,
|
||||||
vram_used_mb=vram_used,
|
vram_used_mb=vram_used,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ class HealthResponse(BaseModel):
|
|||||||
model_downloaded: Optional[bool] = None # Whether model is cached/downloaded
|
model_downloaded: Optional[bool] = None # Whether model is cached/downloaded
|
||||||
model_size: Optional[str] = None # Current model size if loaded
|
model_size: Optional[str] = None # Current model size if loaded
|
||||||
gpu_available: bool
|
gpu_available: bool
|
||||||
|
gpu_type: Optional[str] = None # GPU type (CUDA, MPS, or None)
|
||||||
vram_used_mb: Optional[float] = None
|
vram_used_mb: Optional[float] = None
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user