Spaces:
Sleeping
Sleeping
Factor Studios
commited on
Update ai.py
Browse files
ai.py
CHANGED
|
@@ -24,14 +24,16 @@ class AIAccelerator:
|
|
| 24 |
processing capabilities of the vGPU for AI workloads.
|
| 25 |
"""
|
| 26 |
|
| 27 |
-
def __init__(self, vram=None, num_sms: int = 800, cores_per_sm: int = 222):
|
| 28 |
-
"""Initialize AI Accelerator with electron-speed awareness and WebSocket storage."""
|
| 29 |
from electron_speed import TARGET_SWITCHES_PER_SEC, TRANSISTORS_ON_CHIP, drift_velocity
|
| 30 |
-
from websocket_storage import WebSocketGPUStorage
|
| 31 |
|
| 32 |
-
self.storage =
|
| 33 |
-
if
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
self.vram = vram
|
| 37 |
self.num_sms = num_sms
|
|
|
|
| 24 |
processing capabilities of the vGPU for AI workloads.
|
| 25 |
"""
|
| 26 |
|
| 27 |
+
def __init__(self, vram=None, num_sms: int = 800, cores_per_sm: int = 222, storage=None):
|
| 28 |
+
"""Initialize AI Accelerator with electron-speed awareness and shared WebSocket storage."""
|
| 29 |
from electron_speed import TARGET_SWITCHES_PER_SEC, TRANSISTORS_ON_CHIP, drift_velocity
|
|
|
|
| 30 |
|
| 31 |
+
self.storage = storage # Use the shared storage instance
|
| 32 |
+
if self.storage is None:
|
| 33 |
+
from websocket_storage import WebSocketGPUStorage
|
| 34 |
+
self.storage = WebSocketGPUStorage() # Only create new if not provided
|
| 35 |
+
if not self.storage.wait_for_connection():
|
| 36 |
+
raise RuntimeError("Could not connect to GPU storage server")
|
| 37 |
|
| 38 |
self.vram = vram
|
| 39 |
self.num_sms = num_sms
|