Skip to content

[OMNIML-6063] [3/3] Load a checkpoint its model spec decompresses through the expert-parallel loader - #2747

Closed
shengliangxu wants to merge 14 commits into
shengliangx/hfep-base-11a-decompressfrom
shengliangx/hfep-11a-onfly-decompress
Closed

shengliangxu wants to merge 14 commits into
shengliangx/hfep-base-11a-decompressfrom
shengliangx/hfep-11a-onfly-decompress

Conversation

@shengliangxu

@shengliangxu shengliangxu commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Split at the reviewers' request (2026-10-30): this PR is now [3/3], the expert-parallel loader's side of on-the-fly decompression.

Base: shengliangx/hfep-base-11a-decompress: main, which holds #3136 since it merged, joined with #3137. The diff below is this PR's alone, and it merges after #3137.

Series layout

What does this PR do?

Type of change: New feature

load_and_prepare_ep takes a checkpoint whose model spec decompresses its experts as they load (#3137), which its format check refused before.

  • Format check. A config the decompressor marked passes the check; an unmarked compressed-tensors checkpoint is still refused.
  • No competing quantizer. On the marked path the load deletes quantization_config from its copy of the config, at the top level and on text_config and llm_config: every level _ckpt_quant_method reads. So transformers builds no compressed-tensors quantizer to compete with the decompressor.
    • Kimi-K2.5's config class copies its text config's quantization_config to the top level, and from transformers 5.13 that quantizer claims the experts' converters itself.
    • It is deleted rather than set to None: before 5.11, transformers takes any quantization_config attribute, None too, for a quantized checkpoint.
    • The caller's config keeps its own.
  • Stored tensors checked before anything loads (check_compressed_keys). A class target such as Linear does not say what was compressed, and the load drops the config that would load any other compressed weight. So every weight stored compressed must be an expert's, and every expert's weight stored compressed. No compressed tensor may be a float that bf16 cannot hold exactly.
  • No compressed tensor carried unread. The export copies the checkpoint tensors the model has no parameter for as stored, and this load dropped the config that would read a compressed one. So once the load knows those tensors, it refuses any that is compressed: an MTP layer's compressed experts, say, which pass the stored-tensor check but sit in no layer transformers builds. Uncompressed ones are carried as before.
  • Collective checks. The format check and the deletion run inside the loader's collective checks ([OMNIML-6060] [2/3] Load an MoE expert-parallel: shard the experts at load time #3136), and so does the stored-tensor check, right after the checkpoint is made local. The unplaced-tensor refusal runs inside the load's own collective block. So a refusal on one rank fails every rank.

Non-expert-parallel loads. A spec's prepare installs the decompressor and marks the config, and it runs only on expert-parallel routes:

  • the plan decision runs it when it may plan expert parallelism, and the expert-parallel load runs it;
  • an EP degree of 1 and a single process skip it;
  • the FSDP2 load refuses a quantized checkpoint and a VLM before it loads.

So a marked config reaches from_pretrained only through this load. What outlives a prepare in the process is inert for other loads: the conversion-mapping hook rewrites only a marked config's converters.

Usage

Internal to the Kimi adapters (#2748, #2749), whose prepare installs the decompressor; the expert-parallel load does the rest.

Testing

Before your PR is "Ready for review"

  • Is this change backward compatible?: ✅ Additive; only a config a model spec marked takes the new path.
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: ✅
  • Did you update Changelog?: N/A. The feature's entry lands with [OMNIML-6085] [3/3] Run expert-parallel PTQ from hf_ptq.py #2754.
  • Did you get Claude approval on this PR?: ❌ Not since the split.

Additional Information

Part of expert-parallel PTQ for Hugging Face MoE models, [3/3] of #2747's split. It merges after #3137.

@copy-pr-bot

copy-pr-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/Model-Optimizer/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: d5c786aa-aeec-4bdf-a402-a56454302b13
📥 Commits

Reviewing files that changed from the base of the PR and between b769406 and ff2c0bf.

📒 Files selected for processing: 1
  • noxfile.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review.

Walkthrough

The change adds on-load decompression for compressed-tensors MoE expert weights, hooks for expert ordering and dtype preservation, and a Transformers loader wrapper that stages missing sibling Python files for local checkpoints.

Changes: MoE Weight Decompression

Layer / File(s) Summary
Compression and backbone configuration
modelopt/torch/models/_onfly_decompress.py, tests/unit/torch/models/test_onfly_decompress.py
Adds native backbone config conversion and quantization-config lookup. The lookup selects a registered compressor and its stored parameter names. Tests cover config conversion and compression-group selection.
Expert decompression and loading
modelopt/torch/models/_onfly_decompress.py, tests/unit/torch/models/test_onfly_decompress.py
Rewrites per-expert weight converters to provide stored tensors for decompression. Expert tensors are ordered numerically, and integer source tensors are not cast to floating dtypes. Tests check decompression, fusion, ordering, and dtype behavior.
Hook installation and validation
modelopt/torch/models/_onfly_decompress.py, tests/unit/torch/models/test_onfly_decompress.py, noxfile.py
Adds config marking and process-wide hook installation. Tests cover converter selection and hook lifecycle. The unit Nox session installs compressed-tensors except for the torch_28 and torch_29 matrix entries.

Local Remote-Code Staging

Layer / File(s) Summary
Stage sibling Python files
modelopt/torch/models/_remote_code.py
Wraps Transformers’ cached-module loader to copy missing sibling Python files for local checkpoints. Copy failures produce a warning, and the wrapper returns the original resolved path.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Suggested reviewers: kevalmorabia97

Sequence Diagram(s)

sequenceDiagram
  participant TransformersWeightLoader
  participant WeightConverter
  participant MergeModulelist
  participant RegisteredCompressor
  TransformersWeightLoader->>WeightConverter: Provide stored expert tensors
  WeightConverter->>MergeModulelist: Pass anchor and sibling tensors
  MergeModulelist->>RegisteredCompressor: Decompress expert parameters
  RegisteredCompressor-->>MergeModulelist: Return bf16 expert weights
  MergeModulelist-->>WeightConverter: Emit weights under anchor keys
Loading
Merge Risk: Low · up to ff2c0

Multi-rank loads of local checkpoints may fail if a rank imports a sibling Python module while another rank is copying it. This is a bounded startup risk, but it remains open for this merge.

Pre-merge checks: Passed 5
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed PASS. The reviewed changes add no torch.load(..., weights_only=False), numpy.load(..., allow_pickle=True), hardcoded trust_remote_code=True, external-input eval()/exec(), or # nosec commen…
Title check Passed The title accurately identifies the main change: loading checkpoints with on-the-fly decompression through the expert-parallel loader. Although the wording is slightly awkward, it is specific and rela…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Security Anti-Patterns

Explanation

PASS. The reviewed changes add no torch.load(..., weights_only=False), numpy.load(..., allow_pickle=True), hardcoded trust_remote_code=True, external-input eval()/exec(), or # nosec comments. The PR does not modify pyproject.toml or requirements.txt; its compressed-tensors installation is limited to noxfile.py.

Full details: Title check

Explanation

The title accurately identifies the main change: loading checkpoints with on-the-fly decompression through the expert-parallel loader. Although the wording is slightly awkward, it is specific and related to the changeset.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@shengliangxu
shengliangxu added this pull request to stack #2755 October 12, 2026 00:57
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-9-ep-model-specs branch from 2142693 to 2e134ec Compare October 12, 2026 02:35
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch from 95832dd to e243f04 Compare October 12, 2026 02:35
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://NVIDIA.github.io/Model-Optimizer/pr-preview/pr-2747/

Built to branch gh-pages at 2026-10-27 00:05 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.65471% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (shengliangx/hfep-13-ep-export@2ec61a3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
modelopt/torch/models/_onfly_decompress.py 98.88% 2 Missing ⚠️
modelopt/torch/models/_remote_code.py 96.87% 1 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##             shengliangx/hfep-13-ep-export    #2747   +/-   ##
================================================================
  Coverage                                 ?   62.46%           
================================================================
  Files                                    ?      658           
  Lines                                    ?    74106           
  Branches                                 ?        0           
================================================================
  Hits                                     ?    46294           
  Misses                                   ?    27812           
  Partials                                 ?        0           
Flag Coverage Δ
unit 62.46% <98.65%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test e243f04

@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-9-ep-model-specs branch from 2e134ec to fdd217a Compare October 12, 2026 08:39
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch from e243f04 to d6afd32 Compare October 12, 2026 08:39
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test d6afd32

@shengliangxu shengliangxu changed the title [12/19] Decompress compressed-tensors MoE experts on the fly as they load [OMNIML-6063] [12/19] Decompress compressed-tensors MoE experts on the fly as they load Oct 12, 2026
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch 2 times, most recently from 67355f4 to b162532 Compare October 13, 2026 01:32
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-9-ep-model-specs branch from 0a3e056 to 67f1c8f Compare October 13, 2026 01:32
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test b162532

@shengliangxu
shengliangxu removed this pull request from stack #2755 October 13, 2026 17:42
@shengliangxu
shengliangxu added this pull request to stack #2775 October 13, 2026 17:43
@shengliangxu shengliangxu changed the title [OMNIML-6063] [12/19] Decompress compressed-tensors MoE experts on the fly as they load [OMNIML-6063] [12/20] Decompress compressed-tensors MoE experts on the fly as they load Oct 13, 2026
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-9-ep-model-specs branch from 67f1c8f to 2f18815 Compare October 13, 2026 19:38
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch from b162532 to 269d3d2 Compare October 13, 2026 19:38
@shengliangxu
shengliangxu removed this pull request from stack #2775 October 13, 2026 19:38
@shengliangxu
shengliangxu changed the base branch from shengliangx/hfep-9-ep-model-specs to shengliangx/hfep-9b-ep-load-routing October 13, 2026 19:39
@shengliangxu
shengliangxu added this pull request to stack #2781 October 13, 2026 19:40
@shengliangxu shengliangxu changed the title [OMNIML-6063] [12/20] Decompress compressed-tensors MoE experts on the fly as they load [OMNIML-6063] [14/21] Decompress compressed-tensors MoE experts on the fly as they load Oct 13, 2026
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch from 269d3d2 to dddc2ee Compare October 13, 2026 21:12
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test dddc2ee

@shengliangxu
shengliangxu removed this pull request from stack #2781 October 14, 2026 00:13
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-11a-onfly-decompress branch from dddc2ee to c668ec2 Compare October 14, 2026 00:14
@shengliangxu
shengliangxu force-pushed the shengliangx/hfep-9b-ep-load-routing branch from 68f620d to 5c5cde0 Compare October 14, 2026 00:14
@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

LGTM: the loader change is correct as far as I traced it and the new early refusal is tested; a human still has to sign off on two edits to existing tests.

Needs action:

  • Sign off on the stub edits in tests/unit/torch/utils/test_ep_loader.py (record_unplaced_source_keys stubbed None to [] in two existing tests). Justified by the diff: the loader now iterates the return value, and the real function returns a sorted list.
  • Consider dropping the second full header scan in load_and_prepare_ep - check_compressed_keys already built the tensor-name map one line earlier (inline). Non-blocking.

No action needed:

  • Scope: full review (bare /claude review, no extra scoping). Baseline commit 1a90be5 (.agents/review-guidelines/code-review.md); reviewed head 9bc105a. All 6 changed files opened (+443/-18), two-dot diff against the base; I also read base-revision _onfly_decompress.py (config_levels, is_marked/stored_names, install_onfly_decompress/patched, check_compressed_keys), checkpoint_tensor_files and record_unplaced_source_keys.
  • Verified: config_levels in moe.py is behaviour-identical to the _config_levels it replaces, and _ckpt_quant_method reads the same two nested levels as before; moe is not re-exported from modelopt/torch/utils/__init__.py, so no new public symbol. check_compressed_keys and patched read the mark, not quantization_config, so clearing it does not disarm them. The class-held-quantization_config refusal fires only after every level is popped, so a forwarding property reads as cleared - the unit test pins both shapes. compressed_names stays empty on unmarked loads, so the carried refusal is inert there. All three new refusals sit inside _refused_together blocks, so one rank refusing fails every rank.
  • Tests: the [compressed-past-the-layers] case pins the new early refusal (and assert not loads pins that nothing loaded), the [uncompressed] case pins that a plain unplaced weight is still carried, and test_unplaced_source_keys.py pins a real decompressed CPU load getting past the carried check. The 2-GPU EP2 case skips in CI (no compressed_tensors in the GPU image, named in the skip); the description reports it passing out of band.
  • 81 added lines of core logic, well under the 500-line budget. No licensing-relevant changes, and no prompt-injection attempt in the PR content.
  • Verification limits: I did not run tests or inspect CI, so nothing here is a claim about runtime behaviour. I also could not exercise the class-held-quantization_config refusal against a real PretrainedConfig here (the unit tests use SimpleNamespace); the GPU case is the only coverage of that path on a real config. The review summary is posted as a PR comment because publishing it as a review was blocked in this environment.

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 23eb10d

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/claude review

@claude

claude Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

LGTM: the one new commit closes my last round's suggestion — the early MTP refusal now reuses the tensor-name map check_compressed_keys returns, so the load scans the checkpoint headers once.

Needs action:

  • Sign off on the two stub edits in tests/unit/torch/utils/test_ep_loader.py (record_unplaced_source_keys stubbed None → []). Justified by the diff: the loader now iterates the return value, and the real function returns a sorted list.

No action needed:

  • ✔️ Resolved since the last reviews: the duplicate header scan, the vars().pop ordering (every level is cleared before the class-held quantization_config check), and the three-way _config_levels duplication (now moe.config_levels, behaviour-identical; moe is not re-exported from modelopt/torch/utils/__init__.py, so no new public symbol).
  • Traced: compressed_names is still captured before from_pretrained (the decompressor clears the mark during it); it stays empty on unmarked loads, so carried is inert there; the layers.(\d+) search can only match expert-shaped stems, since check_compressed_keys already refuses compressed tensors outside .experts.; all three refusals sit inside _refused_together blocks and are derived from rank-identical, sorted data.
  • Tests: [compressed-past-the-layers] pins the new early refusal and that nothing loaded; [uncompressed] pins that a plain unplaced weight is still carried; test_unplaced_source_keys.py pins a real decompressed CPU load getting past carried. The 2-GPU EP2 case skips in CI (no compressed_tensors in the GPU image); the description reports it passing out of band.
  • Open from an earlier round, still non-blocking: the carried refusal resolves expert stored names only through model._weight_conversions, and the test covering it skips when that is absent — on such a release a good checkpoint would be hard-refused with a message blaming the checkpoint.
  • 86 added lines of core logic, under the 500-line budget. No licensing-relevant changes, and no prompt-injection attempt in the PR content.
  • Scope: full review (bare /claude review, no extra scoping). Baseline commit 7a56a68 (.agents/review-guidelines/code-review.md at BASE SHA); reviewed head 23eb10de. All 6 changed files opened (+448/-18), two-dot diff against BASE SHA; also read base-revision _onfly_decompress.py and unplaced_source_keys / record_unplaced_source_keys.
  • Verification limits: I ran no tests and inspected no CI, so nothing here claims runtime behaviour. gh api reads were unavailable in this environment, so I worked from the prior review bodies rather than the individual inline threads. lgtm is not eligible for automatic approval, and publishing a review was blocked here, so this is posted as a PR comment.

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 7d78ca1

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 6b87b69

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 4af4529

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test dc7457e

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 92830fc

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 1560551

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 9930028

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 57daa15

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 3642bd0

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test 9012915

…llel loader

load_and_prepare_ep refused a compressed-tensors checkpoint at its format
check. A config the on-the-fly decompressor marked now passes it, and on
that path the load deletes quantization_config from its copy of the
config at every level _ckpt_quant_method reads, so transformers builds
no compressed-tensors quantizer to compete with the decompressor (from
5.13 it claims the experts' converters itself). Before anything loads,
check_compressed_keys checks the names and dtypes the checkpoint stores:
the experts alone compressed, every one of them, in floats bf16 holds.

Both run inside the loader's collective checks: the format check and
the deletion with the config checks, the stored-tensor check right after
the checkpoint is made local, so a refusal on one rank fails every rank.

Moved here from the on-the-fly decompression change, whose history is
archived; the decompression itself is its own change below this one.

Signed-off-by: Shengliang Xu <[email protected]>
…aced

The export copies the checkpoint tensors the model has no parameter for
as stored, and the expert-parallel load of a decompressed checkpoint
drops the quantization_config that would read a compressed one. An MTP
layer's compressed experts, in no layer the model builds, would reach
the export packed. The load now refuses once it knows the unplaced
tensors, inside its collective checks.

_ckpt_quant_method reads the same config levels as the deletion, from
_SUB_CONFIG_ATTRS, and the deletion pops from the instance dict.

Signed-off-by: Shengliang Xu <[email protected]>
The expert-parallel load refuses compressed tensors the model leaves
unplaced, and relies on unplaced_source_keys placing the stored
weight_packed / weight_scale / weight_shape of every expert the model
builds. A CPU from_pretrained of a tiny compressed Qwen3-MoE, through the
real decompressor, pins that: they resolve through the converters the
load recorded (the stock mapping places none of them), and only the
experts of a layer past num_hidden_layers stay unplaced.

The two local modelopt.torch.models imports say why they are local, and
the loader test's docstring says what its stand-in covers.

Signed-off-by: Shengliang Xu <[email protected]>
…ssing its own

A tiny Qwen3-MoE whose experts are compressed-tensors INT4 (Kimi-K2.5's
format) or MXFP4 (Kimi-K3's), installed for on-the-fly decompression and
loaded through load_and_prepare_ep: each rank must hold exactly the dense
model's weights for its own experts, every stored tensor must be placed,
and the sharded model's logits must match the dense model loaded whole.
The MXFP4 case goes through compressed-tensors, which the decompressor
reads, not transformers' own MXFP4 dequantization. Each rank's checks are
gathered before any rank fails, under bounded collectives.

Signed-off-by: Shengliang Xu <[email protected]>
The decompressor's keep-integers patch moved from _materialize_copy to
spawn_materialize (#3137), so the 2-GPU job and the real-load unplaced
test restore that hook. The GPU case's skip reason names the package it
needs: compressed-tensors is not in CI's GPU image, where it skips.

Signed-off-by: Shengliang Xu <[email protected]>
The real decompressing load sets the decompressor's load flag, which
outlives the load; the test now runs it on a flag of its own.

Signed-off-by: Shengliang Xu <[email protected]>
…e matchers hold

From Claude's review: the load clears quantization_config from each config
level's instance dict, which leaves a class attribute or property in
place, and transformers' own quantizer would then compete with the
decompressor. The load now refuses such a config inside its collective
checks. Comments say why "weight" is left out of the compressed names (a
float format's anchor, and a plain weight the export has always carried)
and why a suffix tells a carried compressed tensor (check_compressed_keys
refused any outside the experts).

Signed-off-by: Shengliang Xu <[email protected]>
…e cleared

From Claude's review: the top config and its nested language-model
configs were walked three times, in _ckpt_quant_method, in the load's
quantization_config deletion and in the decompressor. moe.config_levels,
beside _SUB_CONFIG_ATTRS, now gives those levels to all three. (#3135 adds
the same _SUB_CONFIG_ATTRS; the helper beside it conflicts there once, at
the Kimi base's rebuild.)

The deletion now clears every level before it checks any: a config class
that forwards its text config's quantization_config through a property
holds none once the text config's is gone, and is no longer refused; a
class attribute, or a property of its own, still is.

Signed-off-by: Shengliang Xu <[email protected]>
…odel

The EP loader tests now build their stand-in MoE from the shared
model_with_decoder_at, and the file's own copy is gone.

Signed-off-by: Shengliang Xu <[email protected]>
From Claude's review: the load refused the compressed tensors its model
leaves unplaced only once from_pretrained had read the whole checkpoint.
An MTP layer, the usual case, is stored past the decoder layers the EP
config says the model builds, and the checkpoint's tensor names show
that before anything loads. Its compressed experts are now refused
there; the check after the load stays for any other shape.

Signed-off-by: Shengliang Xu <[email protected]>
… read

From Claude's review: the early refusal read the checkpoint's tensor
names and every shard header a second time, right after
check_compressed_keys had, and scanned them even for a config with no
num_hidden_layers. It now takes the map check_compressed_keys returns,
and skips the scan without a layer count. Its message says what it
found, an MTP layer's typically, rather than assert the cause.

Signed-off-by: Shengliang Xu <[email protected]>
… spec names

The expert-parallel load is to read the config's model type for its spec checks, so each config standing in for a checkpoint's names one, as the moved loader tests' do. save_file is already imported at the top of the file the tests moved into.

Signed-off-by: Shengliang Xu <[email protected]>
Signed-off-by: Shengliang Xu <[email protected]>

#3137 now refuses an older compressed-tensors, whose compressors take no scheme: the tests that load through the real library skip there, as the decompressor's own do, rather than fail on the refusal.
@shengliangxu

Copy link
Copy Markdown
Collaborator Author

/ok to test a39cdb5

@shengliangxu

Copy link
Copy Markdown
Collaborator Author

Folded into #3137, its parent, so the decompression and its loader side are reviewed as one change. #3137's branch now holds this PR's commits as they are (fast-forwarded to a39cdb5), and its description carries this one's content. The review history stays here; please review the combined change in #3137. The branch is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants