Conversation
|
This became more relevant with v3.1.0: the new (Checked out v3.1.0 / This PR fixes exactly that, and nothing else needs to change: the new Kimi tests already use the absolute-import style ( |
Neither test module in air_llm/tests/ currently runs: test_compression.py fails at import. It does `from airllm import compress_layer_state_dict, uncompress_layer_state_dict`, but those live in airllm.utils and are not re-exported from the package root, so collecting the module raises ImportError. It also quantizes with .cuda() tensors, so it errors on a CPU-only machine even once importable. test_automodel.py went stale in the v3.0 rewrite. It asserts that garage-bAInd/Platypus2-7B, Mistral and Mixtral resolve to AirLLMLlama2 / AirLLMMistral / AirLLMMixtral, but the rewrite routes all standard architectures through the generic AirLLMBaseModel, so those assertions now fail. It also used a relative import (`from ..airllm.auto_model import ...`) that disagreed with the absolute imports in the other test module, and it needed network access to resolve every repo id. - test_compression.py: import from airllm.utils, and skip (rather than error) when CUDA is unavailable. - test_automodel.py: test the routing offline by faking the config lookup, and cover the current behavior (custom archs -> dedicated classes, standard and unknown archs -> AirLLMBaseModel). Keep the against-the-Hub check as an env-gated test (AIRLLM_TEST_NETWORK=1). - Use absolute imports in both, so one test run collects the whole directory. Verified with both `python -m pytest` and `python -m unittest discover -s tests -t .` from air_llm/: 3 passed, 2 skipped (GPU + network), no new dependency.
c914bfb to
f293fb8
Compare
|
Refreshed against v3.2.0 — the blast radius grew. With So every test you've written for Kimi K3 and Qwen3.8 is collected and then discarded, because This PR is still |
What
Make the two existing test modules in
air_llm/tests/actually runnable. Right now neither one does.Why
test_compression.pyfails at import. It does:but those functions live in
airllm.utilsand are not re-exported from the package root (__init__.pyexportssplit_and_save_layersandNotEnoughSpaceExceptiononly). So collecting the module raises:Because it's a collection error, it takes down the whole test run, not just that module. Separately, the test quantizes with
.cuda()tensors, so even once importable it errors rather than skips on a CPU-only machine.test_automodel.pywent stale in the v3.0 rewrite. It still asserts:but the rewrite routes all standard architectures through the generic
AirLLMBaseModel(onlyARCH_OVERRIDESarchs get dedicated classes), so those three assertions now fail. It also used a relative import (from ..airllm.auto_model import ...) that disagrees with the absolute imports in the other module — the two couldn't be collected by the same run — and it needed network access to resolve every repo id.Changes
test_compression.py: import fromairllm.utils; skip instead of error when CUDA is unavailable.test_automodel.py: test the routing offline by faking the config lookup, asserting current behavior — custom archs (ChatGLM/QWen/Baichuan/InternLM) → dedicated classes; standard archs (Llama, Mistral, Mixtral, Qwen2/3, Phi3, Gemma2, DeepseekV3) and unknown/missing archs →AirLLMBaseModel. The original against-the-Hub check is kept with corrected expectations, gated behindAIRLLM_TEST_NETWORK=1.No production code is touched, and no new dependency is added (the network/GPU gates use
unittest.skipUnless, not pytest markers, so the suite still runs under plainunittest).Testing
From
air_llm/, both runners agree — 3 passed, 2 skipped (the GPU test and the network test):Also confirmed the new offline routing assertions genuinely exercise
ARCH_OVERRIDES(they fail if the mapping is changed).Related: I opened #312 proposing a small CI workflow. This PR is useful on its own regardless of that — but it's also the prerequisite that would let CI run the suite green, so I split it out rather than bundling it there.