Repository navigation
Conversation
Qubitium
added a commit
that referenced
this pull request
Nov 16, 2026
…uantize (#4381) (#4426) * fix: restore base modules and re-pick CPU kernels after weight-only quantize (#4381) * fix(module-tree): quantize consumers after producers in six definitions (#4372) (#4427) LongCat-Flash interleaves attn0 -> mlps0 -> attn1 -> mlps1, but the tree emitted both attention sub-blocks before both MLPs. Its MLA q_a/kv_a and q_b/kv_b also shared a subset. Restructure the layer declaration into per-sub-block entries so the emitted subsets follow the forward order, and split the MLA stages. Also move the attention output projection after its producers in kimi_linear, nemotron_h (including the Nemotron Omni copy), bailing_moe, and deepseek_vl_v2, and give lfm2_moe's conv in_proj/out_proj distinct subsets. Add static subset-order assertions and a generic tiny-model data-flow probe that perturbs each declared Linear and requires every consumer to be in a later subset. Update the registered module-plan fixture, the bailing shared-expert plan test, and teach _tiny_config about lfm2_moe layer types. Add lfm2_moe to the AWQ fold-preservation families. * fix(awq): resolve fp16-only GEMV dtype before calibration (#4394) (#4424) AWQ FORMAT.GEMV/GEMV_FAST/LLM_AWQ kernels declare SUPPORTS_DTYPES=[fp16], but the quantize path loaded a bf16 shell model and only failed in layer-0 finalize after the AWQ search had run. Extend _coerce_quantized_awq_dtype to the quantize path and teach it that AUTO selects fp16-only kernels for those layouts: auto-selected dtypes are fixed to fp16 (logged, whole model) while an explicit unsupported dtype raises a ValueError naming the conflict and both fixes. Apply the same explicit-dtype contract to checkpoint loads. * fix: honour cpu_workers and live kernel policy; warn on retired env vars (#4396) (#4423) * fix(gguf): serialize ggml-cuda entry process-wide (#4378) (#4421) * fix(gguf): serialize ggml-cuda entry process-wide (#4378) `_GGMLBridge.cuda_backend_lock` handed out one lock per CUDA device, so forwards on cuda:0 and cuda:1 could be inside ggml-cuda at the same time. ggml-cuda shares cuBLAS handles and memory pools across devices; on 2x RTX 4090 with PYTHON_GIL=0, 4 threads x 200 forwards aborted 5 of 20 runs in cublasGemmEx. Return one re-entrant process-wide lock from `cuda_backend_lock`. The per-device backend-handle map is unchanged, and single-thread latency is unchanged because a forward already took one lock. Add CPU-runnable regression tests that assert both devices share one lock and that cross-device forwards never overlap inside the backend critical section. They fail on the pre-fix code (max_active == 2). Update the GIL=0 ledger with the concurrency contract change. * test(gguf): give the plan-weight fake the process-wide backend lock The kernel takes the bridge's cuda_backend_lock for every ggml-cuda entry, but _FakeBridge predated that contract and had no such method, so test_kernel_builds_the_weight_once_for_many_batch_sizes failed whenever a CUDA device was visible. Expose the lock from the fake. * test(gguf): collect worker failures as Exception, not BaseException Code Quality flagged the two worker-thread handlers. They still re-raise the collected failure in the main thread; narrowing the catch keeps KeyboardInterrupt/SystemExit out of the collected list. * fix: restore base modules and re-pick CPU kernels after weight-only quantize (#4381) * test(insession): use one import style for gptqmodel.models.base Code Quality flagged the test for importing the module both as an alias and with from-import. The two monkeypatches now target the module path by string, which still rebinds the global that rehome_quantized_kernel looks up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
from_pretrainedresolved theRuntimeConfig/KernelConfigpolicy but never installed it before the per-process thread-pool prebuild, socpu_workerswas ignored by the first load and every later load silently reused the singleton's original worker count. The same policy read was hidden behindlru_cache, so togglingcpu_bf16x3_matmulbetween runs had no effect. RetiredGPTQMODEL_*/GPTQ_TORCH_*variables were also ignored without a warning, and theGPTQMODEL_RESUMEretirement guard had been deleted. The follow-up items (native-GGUF argument forwarding and the internalggufshim) are fixed too.What Changed
models/auto.py: callconfigure_kernel(kernel)before_prebuild_device_thread_poolinfrom_pretrained; retune an existing pool infrom_pretrained/from_quantized; forwardkernel=andp2p=(andp2p=fromload) to the model definition.__init__.py: build the pool with an explicit CPU worker count and addresize_device_thread_pool, which replaces the singleton when the policy asks for a different count. Add a once-per-process warning for every retired env var naming itsKernelConfig/RuntimeConfig/QuantizeConfigreplacement.utils/cpu_features.py,nn_modules/exllamav3_torch.py: cache only the hardware capability probe, not the mutable policy read, socpu_bf16x3_matmulon→off→on is observed by the next forward.models/base.py: restore the deletedGPTQMODEL_RESUMEretirement guard.utils/internal_gguf.py: install the shim only whenimportlib.util.find_spec("gguf")finds no real package.tests/test_cpu_policy_4396.py: CPU-only regressions for pool sizing/resizing, policy toggling, one warning per retired var, GGUF arg forwarding, and shim non-clobbering.Tests
tests/test_cpu_thread_pool*.pydoes not exist in this tree. No GPU or network downloads were used; the model-load tests stub the model definition and the config probe.Model Support / Module Plan
N/A — no new model types or registry entries.
Fixes #4396