mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-07-15 03:30:02 +00:00
* [fix(loader)]: correct off-by-one expert-count guard in SafeTensorLoader.load_experts After the discovery loop, max_experts_count is the highest expert index found (expert count - 1), and is -1 only when the key has no experts. The guard checked == 0, which falsely rejected single-expert layers and silently returned empty weight lists for the zero-expert case. Check == -1 instead. Adds a CPU regression test covering the single-, zero-, and multi-expert cases. * [test(loader)]: import loader as a top-level module in expert-count guard test Per review feedback: add python/utils to sys.path and import loader directly instead of the importlib.util boilerplate. Still bypasses utils/__init__.py (and the compiled kt_kernel_ext) while keeping the import idiomatic.