Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-yardsticks/blob/main/yardsticks/modular-nemotron-h-kvexp/arch.py # aien-yardsticks aien-dev/aien-yardsticks Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-yardsticks / yardsticks / modular-nemotron-h-kvexp / arch.py` 48 lines ยท 1963 bytes Raw Blame History 1 """Register the KV-expanded Nemotron-H architecture (overrides the built-in).""" 2 3 from __future__ import annotations 4 5 from max.graph.weights import WeightsFormat 6 from max.pipelines.context import TextContext 7 from max.pipelines.lib import SupportedArchitecture 8 from max.pipelines.modeling.types import PipelineTask 9 10 # Nemotron-3's chat template is Qwen-format; importing the qwen3_5 parsers here 11 # registers the "qwen3_5" reasoning/tool parsers the architecture names below. 12 from max.pipelines.architectures.qwen3_5.reasoning import ( # noqa: F401 13 Qwen3_5ReasoningParser, 14 ) 15 from max.pipelines.architectures.qwen3_5.tool_parser import ( # noqa: F401 16 Qwen3_5ToolParser, 17 ) 18 from max.pipelines.architectures.nemotron_h.tokenizer import NemotronHTokenizer 19 20 from .config import KvExpandedNemotronHConfig 21 from .model import KvExpandedNemotronHModel 22 from .weight_adapters import convert_kvexp_nemotron_h_state_dict 23 24 kvexp_arch = SupportedArchitecture( 25 # Same name as the built-in -> allowed to override so the checkpoint's 26 # config.json architectures[0] == "NemotronHForCausalLM" resolves here. 27 name="NemotronHForCausalLM", 28 task=PipelineTask.TEXT_GENERATION, 29 example_repo_ids=[ 30 "nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-BF16", 31 ], 32 default_weights_format=WeightsFormat.safetensors, 33 default_encoding=KvExpandedNemotronHConfig.DEFAULT_ENCODING, 34 supported_encodings=KvExpandedNemotronHConfig.SUPPORTED_ENCODINGS, 35 pipeline_model=KvExpandedNemotronHModel, 36 tokenizer=NemotronHTokenizer, 37 context_type=TextContext, 38 weight_adapters={ 39 WeightsFormat.safetensors: convert_kvexp_nemotron_h_state_dict, 40 }, 41 # SSM recurrent state is not reconstructable from a token prefix. 42 required_arguments={"enable_prefix_caching": False}, 43 config=KvExpandedNemotronHConfig, 44 multi_gpu_supported=False, 45 reasoning_parser="qwen3_5", 46 tool_parser="qwen3_5", 47 supports_device_graph_capture=True, 48 )