Repository navigation
[None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper - #21548
Merged
yizhang-nv merged 1 commit intoNov 4, 2026
Merged
yizhang-nv merged 1 commit into
yizhang-nv merged 1 commit into
Conversation
…d mapper The mistral_large_4 checkpoint format registered the generic HF weight loader and mapper, and HfWeightLoader._requires_lazy_safetensors sniffed every checkpoint directory for a Mistral-native params.json to force lazy SafeTensors for Mistral Large 4. Move both into checkpoints/mistral/: - MistralLarge4WeightLoader subclasses HfWeightLoader, always keeps the checkpoint mmapped, and is the default weight loader of MistralLarge4CheckpointLoader. - MistralLarge4WeightMapper subclasses HfWeightMapper and renames nothing, as before. hf/weight_loader.py and hf/weight_mapper.py return to their state before Mistral Large 4 support was added. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
marked this pull request as ready for review
November 4, 2026 07:06
yizhang-nv
requested review from
brnguyen2,
moraxu,
pranav-nvidia and
schetlur-nv
November 4, 2026 07:06
This was referenced Nov 4, 2026
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 8, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main 19c1f46: - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - Per-rank spec-decoding stats travel in main's versioned rank-state frame (version -2 adds a spec snapshot); KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds render_needs_media, forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Warmup/ADP dummies keep the joint-KV-reuse draft allocation on main's dummy request arguments. - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main; llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the feature branch. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 12, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main 19c1f46: - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - Per-rank spec-decoding stats travel in main's versioned rank-state frame (version -2 adds a spec snapshot); KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds render_needs_media, forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Warmup/ADP dummies keep the joint-KV-reuse draft allocation on main's dummy request arguments. - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main; llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the feature branch. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 13, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main 19c1f46: - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds render_needs_media, forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python 0.7.2 and xgrammar 0.2.8 from main; llguidance 1.7.6 and mistral-common>=1.13.0 (Python >= 3.11) from the feature branch. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 17, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 20, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 23, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 23, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 24, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
yizhang-nv
added a commit
to yizhang-nv/TensorRT-LLM
that referenced
this pull request
Nov 26, 2026
Squash of the Mistral Large 4 work on feat/mistral-large-4 (3fb4be0), applied on main (first 19c1f46, now 3705333 with NVIDIA#22185): - fece87e [None][feat] Add Mistral Large 4 support - 9df1a00 [None][fix] Keep requirements installable on Python 3.10 - 5f00308 [None][doc] Mistral Large 4: install from the release container or wheel (NVIDIA#21425) - bed3750 [None][refactor] Mistral Large 4: own the checkpoint weight loader and mapper (NVIDIA#21548) - 3fb4be0 [None][chore] Mistral Large 4: remove defensive checks and leftovers of removed paths (NVIDIA#21616) Not carried: the runtime fixes main took in NVIDIA#21788 (FlashMLA GIL release, attention-DP dummy paired draft KV, context warmup beside a capturable guided decoder, per-rank spec-decoding stats), and the six infra commits already on main (NVIDIA#21133, NVIDIA#19557, (cf7ae79, 1.4.0a0). Adapted to main: - modeling_v2 routing: the family registers its route with @routes("MistralLarge4ForCausalLM") and models/__init__.py imports it; route takes (model_config, llm_args, compute_capability). The routing tests use main's per-family sm_103 fixture; the engine-config tests record the route through registered_routes and resolve on one rank. - thop_attention call sites use main's argument names (workspace, spec_decoding_position_offsets); top_k kernels come from _torch/kernels/blackwell/top_k. - Catalog: the targets' cells move into each op test's TARGET_CELLS (comm ops keep them in CELLS, as main's comm ops do); bmm_out keeps main's op. - DSpark/DFlash: the native drafter's hooks sit on main's refactored worker (block placement, vocab-parallel drafting, Markov TP exchange); the recurrent Markov head takes its hidden states directly and the fused paged-latent path is not taken for drafters with their own block embedding. - KVCacheManagerV2 keeps has_buffer next to main's mixed-precision get_buffers. - Serving: the chat path runs on main's prompt pipeline and ServingExtension hooks; Mistral Large 4 adds forced_tool_call_decoding ("native" required-tool mode) and validate_chat_request. `store` follows main (accepted and ignored). - Tests follow main's engine/runner refactor (ModelEngine, filter_prefill_capture_num_tokens, removed validate_feature_combination), main's scoped reference precision (true_fp32_matmul) and scoped engine environments (scoped_env_overrides). - Dependencies: flashinfer-python and xgrammar from main; llguidance and mistral-common from NVIDIA#22185. Stacked on NVIDIA#22185 (Mistral-native serving). The Mistral-native code that selection, the xgrammar and llguidance Tekken tokenizers, mistral-common chat rendering with images and the mistral_native serving extension, the KV-cache-aware router, trtllm-bench and lm-eval's deferred native chat, and passing history tool-call arguments to mistral-common as sent. On top of it, Mistral Large 4 keeps: - its model type among the native Mistral model types, with its placeholder metadata; - MistralLarge4ServingExtension as a subclass of the Mistral-native one (which now registers for mistral_common only), adding the output-budget check, the forced tool-call grammar and the raw structured-output grammar; - the llguidance JSON grammar that may open with a [THINK] section and the tool-call grammar, from mistral-common's grammar factory; - a Mistral Large 4 prompt's token ids with one [IMG] per image expanded to the image grids (other checkpoints keep NVIDIA#22185's check); - lm-eval's native chat token ids and scoring on the reasoning parser's content, and mistral-style tool-call ids. The feature branch's own copies of these paths, its native_chat processor branch and its coercion of malformed history tool-call arguments are dropped. Signed-off-by: Yi Zhang <[email protected]>
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.
@coderabbitai summary
Description
Part of merging Mistral Large 4 back into
main. This narrows how much of the shared checkpoint code ML4 support changes.On
feat/mistral-large-4, themistral_large_4checkpoint format reuses the generic HF classes:HfWeightLoaderandHfWeightMapperare registered formistral_large_4.HfWeightLoader._requires_lazy_safetensorsreadsparams.jsonin every checkpoint directory. If the file describes a Mistral-native ML4 checkpoint, it forces lazy SafeTensors.This PR moves both into
checkpoints/mistral/:MistralLarge4WeightLoader(HfWeightLoader)lives in the newmistral/weight_loader.pyand is registered formistral_large_4. Its_requires_lazy_safetensorsalways returnsTrue, and it is the default weight loader ofMistralLarge4CheckpointLoader.MistralLarge4WeightMapper(HfWeightMapper)is registered formistral_large_4. As before, it renames nothing, because the modeling_v2 targets read the Mistral-native tensor names themselves.hf/weight_loader.pyandhf/weight_mapper.pyare back to their state at the merge base withmain(59eab99). They no longer conflict with whatmainhas since changed in those files.Behavior:
checkpoint_format="mistral_large_4", the checkpoint stays mmapped (lazy SafeTensors), and the mapper still renames nothing.HfWeightLoaderno longer opensparams.jsonfor each checkpoint it loads.model_loader._construct_checkpoint_loaderpassescheckpoint_io_policyandpartial_model_loadingonly to an exactHfWeightLoader, so the ML4 loader now gets the defaults. Loading does not change: an ML4 checkpoint requires lazy SafeTensors, so a requested read-ahead policy already fell back to native. Only the checkpoint I/O status log differs, now reportingrequested=native.checkpoint_formatis no longer read lazily. That combination was already unsupported, and it still fails: the HF/default formats are rejected while the config loads, andmistral/mistral_large_3prefix tensor names that the ML4 targets do not know.The three modeling_v2 targets'
weights.pyfiles are unchanged.Test Coverage
tests/unittest/_torch/test_model_config.py::test_mistral_large4_native_checkpointis extended. It checks thatmistral_large_4resolves toMistralLarge4WeightLoader(lazy) andMistralLarge4WeightMapper, and thatHfWeightLoaderno longer treats a directory with onlyparams.jsonas lazy.The HF lazy-SafeTensors tests in
tests/unittest/_torch/models/checkpoints/hf/test_weight_loader.pyare unchanged and pass.I ran the following locally on a B200 node with GPUs hidden (
CUDA_VISIBLE_DEVICES=):pytest -m cpu_only tests/unittest/_torch/modeling_v2/models/mistral_large4 tests/unittest/_torch/models/checkpoints tests/unittest/_torch/test_model_config.py tests/unittest/_torch/modeling_v2/test_modeling_v2_routing.py tests/unittest/_torch/modeling_v2/test_modeling_v2_claims.pyResult: 1201 passed, 481 skipped, 0 failed. The skipped cases need the ML4 checkpoint under
LLM_MODELS_ROOT, which that node does not have.Not run: GPU/sm_103 tests, and an end-to-end load of the real checkpoint on GB300.
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.🤖 Generated with Claude Code