Spaces:
Sleeping
Sleeping
File size: 1,191 Bytes
43464e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import asyncio
import numpy as np
from ai import AIAccelerator
async def main():
print("\n--- Testing AIAccelerator with WebSocket Storage ---")
try:
accelerator = AIAccelerator()
await accelerator.connect_to_storage()
print("AIAccelerator initialized and connected successfully.")
# Test model upload
dummy_model_info = {"layers": 5, "neurons": 100, "type": "CNN"}
model_name = "test_cnn_model"
print(f"Attempting to store model: {model_name}")
if await accelerator.store_model_state(model_name, dummy_model_info):
print(f"Model \'{model_name}\' stored successfully.")
else:
print(f"Failed to store model \'{model_name}\'")
# Test tensor core initialization (requires VRAM connection)
print("Attempting to initialize tensor cores...")
if accelerator.initialize_tensor_cores():
print("Tensor cores initialized successfully.")
else:
print("Failed to initialize tensor cores.")
except Exception as e:
print(f"An error occurred during AIAccelerator testing: {e}")
if __name__ == "__main__":
asyncio.run(main())
|