Skip to content

FreeToken brings datacenter-scale model serving to your desktop. Run massive models locally, fast and efficiently.

fix(tests): support ROCm in AIME GPU memory checks (#763)

LZ_QAQfe5a5ec9c564
diff --git a/tests/e2e/test_aime.py b/tests/e2e/test_aime.py
index 3dde4cad..75070396 100644
--- a/tests/e2e/test_aime.py
+++ b/tests/e2e/test_aime.py
@@ -34,6 +34,7 @@ import json
import os
import re
import subprocess
+import sys
from pathlib import Path
import pytest
@@ -206,6 +207,16 @@ def visible_gpu_index() -> int:
def free_gpu_memory_gib() -> float:
+ if torch.version.hip is not None:
+ # Query logical device zero without initializing the engine's parent process.
+ result = subprocess.run(
+ [sys.executable, "-c", "import torch; print(torch.cuda.mem_get_info(0)[0])"],
+ check=True,
+ text=True,
+ capture_output=True,
+ )
+ return int(result.stdout.strip()) / (1 << 30)
+
result = subprocess.run(
[
"nvidia-smi",