Update utils/system/memory_manager.py
Browse files
utils/system/memory_manager.py
CHANGED
|
@@ -20,7 +20,9 @@ class MemoryManager:
|
|
| 20 |
Comprehensive memory management for video processing applications
|
| 21 |
"""
|
| 22 |
|
| 23 |
-
def __init__(self, device
|
|
|
|
|
|
|
| 24 |
self.device = device
|
| 25 |
self.gpu_available = device.type in ['cuda', 'mps']
|
| 26 |
self.memory_limit_gb = memory_limit_gb
|
|
|
|
| 20 |
Comprehensive memory management for video processing applications
|
| 21 |
"""
|
| 22 |
|
| 23 |
+
def __init__(self, device, memory_limit_gb: Optional[float] = None):
|
| 24 |
+
if isinstance(device, str):
|
| 25 |
+
device = torch.device(device)
|
| 26 |
self.device = device
|
| 27 |
self.gpu_available = device.type in ['cuda', 'mps']
|
| 28 |
self.memory_limit_gb = memory_limit_gb
|