Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Skip the GLM dense tune imports when there is nothing to tune (#16)

Victor Nogueira2e54f2c07291
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4fe4ec4..581ab26 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -32,7 +32,7 @@ pip install pytest
for t in tests/test_ablit_runtime_cpu.py tests/test_uncensor_bundled_cpu.py tools/glm/test_serve.py tools/mimo/test_serve.py tools/mimo/test_toolcalls.py; do PYTHONPATH=. pytest -q $t; done
```
-`tools/glm/test_serve.py` takes a few minutes. If it hangs, look for a stale lock file at `~/.cache/torch_extensions/*/exllamav3_ext/lock` and remove it. GPU tests under `tests/` need a built extension and a free GPU; say in the pull request whether you ran them.
+If a test or the first import hangs, look for a stale lock file at `~/.cache/torch_extensions/*/exllamav3_ext/lock` and remove it. GPU tests under `tests/` need a built extension and a free GPU; say in the pull request whether you ran them.
## Pull requests
diff --git a/README.md b/README.md
index 97cb829..2cc57ba 100644
--- a/README.md
+++ b/README.md
@@ -88,7 +88,7 @@ The engine can project one fixed direction out of the residual stream at run tim
pip install pytest
for t in tests/test_ablit_runtime_cpu.py tests/test_uncensor_bundled_cpu.py tools/glm/test_serve.py tools/mimo/test_serve.py tools/mimo/test_toolcalls.py; do PYTHONPATH=. pytest -q $t; done
```
-Run each file separately because two files share a name (`test_serve.py`). These tests need no GPU and no built extension. Last run (CPU only, clean clone and venv): 3, 16, 7 of 8, 13 and 15 passed (`tools/glm/test_serve.py` takes a few minutes; its one failure, `test_dense_tune_path_follows_the_cpp_tuner`, needs the built extension). GPU tests need a built extension and a free GPU.
+Run each file separately because two files share a name (`test_serve.py`). These tests need no GPU and no built extension. GPU tests need a built extension and a free GPU.
## Build on CUDA
The CUDA build is the upstream one and is unchanged. Install a CUDA 12.4 or newer build of PyTorch, then `pip install -r requirements.txt && pip install .`. `README.upstream.md` has the full upstream guide (wheels, PyPI, uv, Windows, architecture list, conversion tool, examples). `README.strix-halo.md` has the kernel notes and benchmark harnesses.
diff --git a/tools/glm/serve.py b/tools/glm/serve.py
index b5eef72..7fbdae0 100644
--- a/tools/glm/serve.py
+++ b/tools/glm/serve.py
@@ -396,11 +396,12 @@ def prime_dense_tune(budget_s: float = 600.0) -> tuple[int, float]:
class (15 shapes). Warm-up has just logged every shape it met, so cross those shapes with all
classes 256..4096 and pay the tuning here. A cached key costs one GEMM. Tuned winners are
bit-exact with the default path, so outputs do not change. Returns (keys, seconds)."""
- import torch
- from exllamav3.ext import exllamav3_ext as ext
path = dense_tune_path()
if os.environ.get("EXL3_DENSE_GEMM_TUNE", "1") == "0" or not path.exists():
return 0, 0.0
+ # Imported after the early return, so a disabled tuner or a missing cache file needs no built extension.
+ import torch
+ from exllamav3.ext import exllamav3_ext as ext
# Only the row classes a prefill chunk can reach (<= 4096); the cache file may hold bigger classes
# from other runs, and sizing the buffers for them cost ~6 GB of GTT on a 128 GB box.
max_class = int(os.environ.get("EXL3_SERVE_DTUNE_MAX_CLASS", "4096"))