Repository navigation
Fix marlin model loading compat with autogptq - #290
Merged
Merged
Conversation
Contributor
|
I have reviewed this PR. @merrymercy @hnyls2002 Ready for review/merge. AutoGPTQ main actually has broken Marlin direct quantize support. Use my pending PR AutoGPTQ/AutoGPTQ#586 to quant Marlin. |
timethink
pushed a commit
to timethink/sglang
that referenced
this pull request
Mar 9, 2025
Co-authored-by: LRL <[email protected]>
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Jul 30, 2026
…-proven — drafter ran on torch.empty (accept 1.00 was inference over uninitialized weights): draft quantization keyed on TARGET model_path built a dense skeleton while GGUFModelLoader streamed qweight names into it; ReplicatedLinear had no GGUF weight_loader branch (fc could not load even with correct skeleton); DFlash load_weights skipped all unresolvable names silently — now raises on unloaded parameters; desk gate had validated a different model than the runtime builds (GGUFConfig() skeleton); fix loads 43/43 packed, 1.71 GiB resident, dequant rel err 0.006; 10 new tests, model_loader regression clean
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Jul 30, 2026
/spinning/wt-final was at e1b17fe when the window opened; sgl-project#303 (7f21cea) merged at 20:49:25Z, between the gate run and the ceiling boots, and sgl-project#290 (56dcf57) at 21:01:03Z. Checked what moved: 15 files, and the diff over managers/, distributed/ and benchmark/ is empty -- neither the BAR1 gate's code nor admission_limiter/scheduler/server_args were touched, so the numbers stand. uneven_perf.py (the sgl-project#303 probe fix) sits on the path the pinned --rank-mlp-ratio bypasses, and battery_host.sh was already sourced by the gate before the merge landed. Consequence for merging: this report is written against the e1b17fe version of INTEGRATION_R3_VALIDATION.md and does not contain the sgl-project#303 section -- an append conflict, both sections stay.
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Jul 30, 2026
…zvous hardening fixed it, link matrix completes in 15.3s vs 469s (inherited MASTER_ADDR from launcher was the trigger, 45s cap never needed); migration carries all four v2 link entries, fresh values match within 2%; honest correction: lanes top-up cost 132s from one-time nvcc cold build per arch, not 6s; FP8 lanes on 3080 ALL fail (scaled_mm CC>=8.9, marlin/w8a16 NoKernelImage sm86 = sgl-project#304 — now an ACCURACY issue for auto-performance, planner compares 570 fp8 vs 61.8 dense-bf16); sgl-project#290 kernel check exit 0 (1.71 GiB packed, rel err 0.0055-0.0074; needs htsglang-gpu venv for GGUF bindings); s04 DFLASH-solo-Q8 accept collapse GONE: 6.19/6.86/9.60 synthetic, code 4.27 vs NEXTN 3.279, prose 2.95 vs 2.688 — prose<code ordering consistent with accept logic # Conflicts: # docs/dev/INTEGRATION_R3_VALIDATION.md
efschu
added a commit
to efschu/htsglang
that referenced
this pull request
Jul 31, 2026
…t fix — (1) root: draft quantization decided on the CHECKPOINT NAMESPACE (safetensors index names only, fires only when draft+inherited+quant_config+zero packed markers), narrowed by _quant_cfg_excludes_draft_namespace so producers that wrote the exemption down (AWQ/FP8 siblings) keep their exact path — verified against all three real checkpoints; (2) flag repaired: explicitly-unset vs inherited now distinguishable for the draft flag, and the same latent hole closed on the TARGET --quantization unquant (its guard only gated sm100 overrides, never checkpoint re-derivation); (3) sgl-project#290 guard extended: it lived inside DFlashDraftModel.load_weights (one arch) while Qwen3_5ForCausalLMMTP only warned per name — raise_on_unloaded_draft_parameters now runs from DefaultModelLoader before process_weights_after_loading, vocab modules exempt, None-returning models untouched, env escape hatch; 35 new tests incl. replay of the real load_weights over the real 15 mtp names (dense writes 12, packed leaves 16 unloaded -> named raise), all sweeps byte-identical to base
efschu
pushed a commit
to efschu/htsglang
that referenced
this pull request
Sep 19, 2026
…ed draft per rank are sharded -- selector codebooks vocab-parallel, fc and the ten conv kernel projections row-parallel; DESK-BEWIESEN (CPU), no metal run Stage 1 (d7eaba4) sharded the draft's attention and MLP by the --rank-tp-ratio plan and then MEASURED what was left: boot xsn402 logged "DFLASH draft parameter bytes on rank N" as 1264 / 968 / 958 MB, of which 522 MB sat identically on all three ranks -- the candidate selector's two [248320, 256] codebooks (254 MB), fc (133 MB) and the ten grouped-conv kernel projections (131 MB). That is the replicated remainder the shard proof named, and this commit removes it with the fork's OWN parallel primitives instead of a second implementation. A) CandidateSelector.{predecessor,successor}_codebook: bare nn.Parameter -> VocabParallelEmbedding, exactly what the lm_head uses. Each rank holds a row band, masks the ids outside it to zero, and one all-reduce per table reassembles the rows. The masked lookup is EXACT, not approximate: compute_candidates all-gathers the per-shard top-k and re-ranks, so every rank asks for the same global ids and the ranks that do not own a row contribute a zero row. The vocab axis splits EVENLY even under an uneven base plan ("vocab always even", tp_vocab_ratios) -- 82816 of 248448 padded rows per rank, 84.8 MB for the pair instead of 254 MB. --rank-vocab-ratio remains the lever that makes it ratio-weighted, unchanged and untested here. The two lookups moved OUT of the @torch.compile'd _score_edges and into build_lattice: a sharded lookup ends in a collective, and a collective does not belong in a compile graph. _score_edges keeps the arithmetic it was compiled for (one einsum plus an add) and takes the looked-up rows. B) fc: ReplicatedLinear -> RowParallelLinear(input_is_parallel=False). The input is the concatenation of the K target-layer hidden states and every rank holds it in full (the target's hidden states are replicated after its own all-reduce), so the layer cuts the contraction axis itself by the plan. 25600 in 16-element units over (39, 13, 12) = 15600 / 5200 / 4800. C) DFlashGroupedConv.kernel_projection: nn.Linear -> RowParallelLinear (input_is_parallel=False), NOT column-parallel + all-gather. Both split the same weight by the same ratio; the difference is the collective. Under an uneven plan the per-rank group bands have DIFFERENT widths, and this fork's all_gather(dim=-1) is equal-size-only (the output size is input_size[0] * world_size) while all_gatherv is dim-0 and pynccl-only -- so column-parallel would mean padding to the widest rank plus narrow+cat surgery, ten times per forward. Row-parallel needs none of it and its all-reduce has the SAME shape on every rank, which is what keeps the collective sequence rank-uniform. 5120 over (39, 13, 12) = 3120 / 1040 / 960 per rank, times ten convs. base_kernel stays replicated (41 kB per conv). RowParallelLinear.forward: input_is_parallel=False now cuts the replicated input by the SHARD PLAN when one is installed, instead of split_tensor_along_last_dim's even divide() -- which under (39, 13, 12) raises on the first non-divisible dimension rather than computing the wrong thing. Guarded on tp_plan_active, so the default path runs the identical even split it always did (pinned by a test). load_weights: the checkpoint's `candidate_selector.*_codebook` is now `....codebook.weight`; the rename is scoped to names ending in `_codebook` so no other tensor can be silently absorbed by a module's weight. The fc.weight K-mismatch guard compares against the LOGICAL (output_size, input_size) -- against param.shape it would fire on every correct checkpoint under TP>1. The sgl-project#290 unloaded-parameter count still covers all three groups. Solo placement is unchanged by construction: ModelRunner builds the solo draft (host AND shadows) inside get_parallel().override(tp_size=1), the parallel layers cache tp_size at construction, and all three modules then hold the full weight and issue no collective. Pinned by a test that counts the collectives under a solo-shaped build while a TP3 plan is installed. New collectives per draft round: 2 all-reduces of [b, block-1, K, r] for the selector, 1 of [N, hidden] for fc per context append, 10 of [tokens, 2*taps*num_groups] for the convs per draft-model forward. The last group is the cost to weigh at the metal. TESTS (CPU, hermetic, CUDA_VISIBLE_DEVICES=""): new test/registered/unit/distributed/test_dflash_draft_shard_stage2.py new test/registered/unit/models/test_dflash_draft_weight_names_stage2.py Gate suite (both new files + test_dflash_uneven_tp_heads, test_dflash_logits, test_weg2_spec_form_dflash, test_gguf_dflash_name_map, test_gguf_dflash_sibling_config, test_spec_default_directions_620, test_uneven_tp_weight_loading, test_uneven_tp_family_plans): 136 passed, 10 skipped, 0 failed. Regression sweep over all 66 unit test files that reference dflash / RowParallelLinear / VocabParallelEmbedding / ParallelLMHead: 1783 passed, 34 skipped, 7 failed -- ALL SEVEN PRE-EXISTING: six (test_solo_weight_planner x4, test_gguf_draft_quantization, test_instrument_reachability_861l) reproduce bit-identically against the pristine HEAD tree (6 failed / 29 passed / 3 skipped both ways), and test_weg2_1394_draft_in_exchange::test_no_draft_worker_is_a_clean_none_ not_a_failure is the known red case. test_dflash_logits had to wrap its bare CandidateSelector construction in a tp_size=1 parallel context: VocabParallelEmbedding reads the context at construction where nn.Parameter did not. STAND: DESK-BEWIESEN. No boot, no serving, no CUDA was run for this change; the metal acceptance is the user's call.
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.
Fix Issue #289
Autogptq uses is_marlin_format for Marlin. So depending on how/tool used to quantize, it can be quant_method=="marlin" or quant_method=="gptq" and is_marlin_format==True. Technically, Marlin is a format, not new quant method so autogptq way is more correct. But regardless, this PR will allow both methods to work.