Factor Studios commited on
Commit
bd3e2ef
·
verified ·
1 Parent(s): 8135984

Update ai.py

Browse files
Files changed (1) hide show
  1. ai.py +8 -6
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 = WebSocketGPUStorage()
33
- if not self.storage.wait_for_connection():
34
- raise RuntimeError("Could not connect to GPU storage server")
 
 
 
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