forked from nikopueringer/CorridorKey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_vram.py
More file actions
26 lines (17 loc) · 718 Bytes
/
test_vram.py
File metadata and controls
26 lines (17 loc) · 718 Bytes
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
import numpy as np
import torch
from CorridorKeyModule.inference_engine import CorridorKeyEngine
def test_vram():
print("Loading engine...")
engine = CorridorKeyEngine(checkpoint_path="CorridorKeyModule/checkpoints/CorridorKey_v1.0.pth", img_size=2048)
# Create dummy data
img = np.random.randint(0, 255, (2160, 3840, 3), dtype=np.uint8)
mask = np.random.randint(0, 255, (2160, 3840), dtype=np.uint8)
# Reset stats
torch.cuda.reset_peak_memory_stats()
print("Running inference pass...")
engine.process_frame(img, mask)
peak_vram = torch.cuda.max_memory_allocated() / (1024**3)
print(f"Peak VRAM used: {peak_vram:.2f} GB")
if __name__ == "__main__":
test_vram()