Skip to content

[model] fix: use local GPT spec for CPU-only initialization - #5317

Closed
cuichenx wants to merge 1 commit into
mainfrom
agent/cpu-only-local-gpt-spec
Closed

[model] fix: use local GPT spec for CPU-only initialization#5317
cuichenx wants to merge 1 commit into
mainfrom
agent/cpu-only-local-gpt-spec

Conversation

@cuichenx

@cuichenx cuichenx commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
Summary

What

  • Select the MCore-local GPT layer spec when use_cpu_initialization=True
    and CUDA is unavailable, avoiding CUDA-only Transformer Engine module
    construction on CPU-only hosts.
  • Keep the existing TE spec when CUDA is available.
  • Propagate the same local-versus-TE choice to MTP block construction.

This revisits the narrow spec-selection portion of #3853 in response to a real
full openai/gpt-oss-20b CPU-import failure. It does not revive that closed PR's
broader provider monkeypatches.

Compatibility gate

The local-spec versus later GPU/TE checkpoint compatibility concern that closed
#3853 is treated as an acceptance gate, not assumed away. Current MCore provides
canonical sharded-state mappings and direct local-GPT-spec ↔ TE-GPT-spec
save/load coverage, including SequentialMLP ↔ TEGroupedMLP interchange.

Before this PR is called verified, a full GPT-OSS checkpoint produced by the
CPU-only local-spec path must load into the GPU/TE model from exact clean pushed
commits. If it does not, this approach is not acceptable.

Validation

  • tests/unit_tests/models/test_gpt_provider.py: 29 passed in a
    driverless 26.06 container.
  • uv run --no-sync pre-commit run --all-files.
  • Full openai/gpt-oss-20b CPU import from a clean public integration
    commit.
  • Load the CPU-produced checkpoint into the GPU/TE GPT-OSS model.

No tests will be quarantined without Chen's explicit approval. No local source
patch or unpublished overlay may be counted as verification evidence.

Avoid constructing CUDA-only Transformer Engine modules when GPT models are initialized on a host without visible CUDA. Keep the TE path unchanged when CUDA is available, and propagate the same backend choice to MTP specs.

This revives the narrow spec-selection portion of #3853 now that full-model CPU import and GPU/TE checkpoint-load compatibility are explicit validation gates.

Co-authored-by: Yu Yao <54727607+yaoyu-33@users.noreply.github.com>
Signed-off-by: Chen Cui <chcui@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 4, 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.

@cuichenx cuichenx added area:ckpt Checkpoint conversion, loading, export, and save paths bug Something isn't working needs-more-tests Requires additional L0 and L1 test coverage before merge labels Aug 4, 2026
@cuichenx

Copy link
Copy Markdown
Contributor Author

Closing this standalone approach. Selecting local GPT/MTP specs does not by itself solve driverless Transformer Engine import, and local-to-TE checkpoint schema compatibility is not guaranteed across model families. Any future CPU-only conversion fix should be validated as an end-to-end design rather than landing this isolated selector.

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

Labels

area:ckpt Checkpoint conversion, loading, export, and save paths bug Something isn't working needs-more-tests Requires additional L0 and L1 test coverage before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant