brazley commited on
Commit
a39da9c
·
verified ·
1 Parent(s): aef7a1a

Add NVFP4 weights, config, tokenizer, and trust_remote_code modeling files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. audio_model.py +174 -0
  3. chat_template.jinja +273 -0
  4. config.json +0 -0
  5. configuration.py +114 -0
  6. configuration_nemotron_h.py +262 -0
  7. configuration_radio.py +152 -0
  8. evs.py +73 -0
  9. generation_config.json +14 -0
  10. hf_quant_config.json +0 -0
  11. image_processing.py +148 -0
  12. model-lm-00000.safetensors +3 -0
  13. model-lm-00001.safetensors +3 -0
  14. model-lm-00002.safetensors +3 -0
  15. model-lm-00003.safetensors +3 -0
  16. model-lm-00004.safetensors +3 -0
  17. model-lm-00005.safetensors +3 -0
  18. model-lm-00006.safetensors +3 -0
  19. model-lm-00007.safetensors +3 -0
  20. model-lm-00008.safetensors +3 -0
  21. model-lm-00009.safetensors +3 -0
  22. model-lm-00010.safetensors +3 -0
  23. model-lm-00011.safetensors +3 -0
  24. model-lm-00012.safetensors +3 -0
  25. model-lm-00013.safetensors +3 -0
  26. model-lm-00014.safetensors +3 -0
  27. model-lm-00015.safetensors +3 -0
  28. model-lm-00016.safetensors +3 -0
  29. model-lm-00017.safetensors +3 -0
  30. model-lm-00018.safetensors +3 -0
  31. model-lm-00019.safetensors +3 -0
  32. model-lm-00020.safetensors +3 -0
  33. model-lm-00021.safetensors +3 -0
  34. model-lm-00022.safetensors +3 -0
  35. model-lm-00023.safetensors +3 -0
  36. model-lm-00024.safetensors +3 -0
  37. model-lm-00025.safetensors +3 -0
  38. model-lm-00026.safetensors +3 -0
  39. model-lm-00027.safetensors +3 -0
  40. model-lm-00028.safetensors +3 -0
  41. model-lm-00029.safetensors +3 -0
  42. model-lm-00030.safetensors +3 -0
  43. model-lm-00031.safetensors +3 -0
  44. model-lm-00032.safetensors +3 -0
  45. model-lm-00033.safetensors +3 -0
  46. model-lm-00034.safetensors +3 -0
  47. model-lm-00035.safetensors +3 -0
  48. model-lm-00036.safetensors +3 -0
  49. model-lm-00037.safetensors +3 -0
  50. model-lm-00038.safetensors +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
audio_model.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Sound/Audio model components for multimodal integration.
16
+
17
+ This module provides the SoundEncoder (wrapping Parakeet from HuggingFace transformers)
18
+ and SoundProjection (MLP to project audio embeddings to LLM hidden size).
19
+
20
+ The Parakeet model in HuggingFace transformers is documented at:
21
+ https://huggingface.co/docs/transformers/en/model_doc/parakeet
22
+ """
23
+
24
+ from typing import Optional
25
+
26
+ import torch
27
+ import torch.nn as nn
28
+
29
+ from transformers import ParakeetEncoder, ParakeetEncoderConfig
30
+ from transformers.utils import logging
31
+
32
+ logger = logging.get_logger(__name__)
33
+
34
+
35
+ class SquaredReLU(nn.Module):
36
+ """Squared ReLU activation function."""
37
+ def forward(self, x):
38
+ return torch.pow(torch.nn.functional.relu(x), 2)
39
+
40
+
41
+ class RMSNorm(nn.Module):
42
+ def __init__(self, hidden_size, eps=1e-5):
43
+ super().__init__()
44
+ self.weight = nn.Parameter(torch.ones(hidden_size))
45
+ self.eps = eps
46
+
47
+ def forward(self, hidden_states):
48
+ input_dtype = hidden_states.dtype
49
+ hidden_states = hidden_states.to(torch.float32)
50
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
51
+ hidden_states = hidden_states * torch.rsqrt(variance + self.eps)
52
+ return (self.weight.to(torch.float32) * hidden_states).to(input_dtype)
53
+
54
+
55
+ class SoundProjection(nn.Module):
56
+ """MLP projection from sound encoder hidden size to LLM hidden size.
57
+
58
+ Architecture: RMSNorm -> linear1 -> SquaredReLU -> linear2
59
+
60
+ This matches the Megatron checkpoint conversion structure:
61
+ - sound_projection.norm.weight
62
+ - sound_projection.linear1.weight
63
+ - sound_projection.linear2.weight
64
+ - sound_projection.linear1.bias (optional)
65
+ - sound_projection.linear2.bias (optional)
66
+ """
67
+
68
+ def __init__(
69
+ self,
70
+ sound_hidden_size: int,
71
+ projection_hidden_size: int,
72
+ llm_hidden_size: int,
73
+ bias: bool = True,
74
+ eps: float = 1e-5,
75
+ ):
76
+ super().__init__()
77
+ self.norm = RMSNorm(sound_hidden_size, eps=eps)
78
+ self.linear1 = nn.Linear(sound_hidden_size, projection_hidden_size, bias=bias)
79
+ self.activation = SquaredReLU()
80
+ self.linear2 = nn.Linear(projection_hidden_size, llm_hidden_size, bias=bias)
81
+
82
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
83
+ """Project sound embeddings to LLM embedding space.
84
+
85
+ Args:
86
+ hidden_states: Sound encoder output [batch, seq_len, sound_hidden_size]
87
+
88
+ Returns:
89
+ Projected embeddings [batch, seq_len, llm_hidden_size]
90
+ """
91
+ hidden_states = self.norm(hidden_states)
92
+ hidden_states = self.linear1(hidden_states)
93
+ hidden_states = self.activation(hidden_states)
94
+ hidden_states = self.linear2(hidden_states)
95
+ return hidden_states
96
+
97
+
98
+ class SoundEncoder(nn.Module):
99
+ """Wrapper around the Parakeet encoder from HuggingFace transformers.
100
+
101
+ The Parakeet model is an ASR model with a Fast Conformer encoder.
102
+ We use only the encoder portion to extract audio embeddings.
103
+
104
+ Checkpoint structure:
105
+ - sound_encoder.encoder.feature_extractor.* -> Feature extraction (mel spectrogram)
106
+ - sound_encoder.encoder.pre_encode.* -> Pre-encoding convolutions
107
+ - sound_encoder.encoder.layers.* -> Conformer layers
108
+
109
+ Reference: https://huggingface.co/docs/transformers/en/model_doc/parakeet
110
+ """
111
+
112
+ def __init__(self, config=None):
113
+ super().__init__()
114
+
115
+ if config is not None:
116
+ # Build from config - handle both dict and config object
117
+ if hasattr(config, '__dict__'):
118
+ # It's a config object, extract relevant params for ParakeetConfig
119
+ config_dict = {
120
+ 'attention_bias': getattr(config, 'attention_bias', False),
121
+ 'hidden_size': getattr(config, 'hidden_size', 1024),
122
+ 'num_attention_heads': getattr(config, 'num_attention_heads', 8),
123
+ 'num_hidden_layers': getattr(config, 'num_hidden_layers', 24),
124
+ 'intermediate_size': getattr(config, 'intermediate_size', 4096),
125
+ 'conv_kernel_size': getattr(config, 'conv_kernel_size', 31),
126
+ 'convolution_bias': getattr(config, 'convolution_bias', False),
127
+ 'feat_in': getattr(config, 'feat_in', 80),
128
+ 'subsampling_factor': getattr(config, 'subsampling_factor', 8),
129
+ 'subsampling_conv_channels': getattr(config, 'subsampling_conv_channels', 256),
130
+ 'subsampling_conv_kernel_size': getattr(config, 'subsampling_conv_kernel_size', 3),
131
+ 'subsampling_conv_stride': getattr(config, 'subsampling_conv_stride', 2),
132
+ 'num_mel_bins': getattr(config, 'num_mel_bins', 128),
133
+ 'scale_input': getattr(config, 'scale_input', False),
134
+ }
135
+ elif isinstance(config, dict):
136
+ config_dict = config
137
+ else:
138
+ config_dict = {}
139
+
140
+ # Create ParakeetConfig with the extracted parameters
141
+ parakeet_config = ParakeetEncoderConfig(**config_dict)
142
+ self.config = parakeet_config
143
+ self.encoder = ParakeetEncoder(parakeet_config)
144
+ else:
145
+ raise ValueError(
146
+ "config must be provided, "
147
+ "and ParakeetEncoder must be available in transformers."
148
+ )
149
+
150
+ def forward(
151
+ self,
152
+ input_features: torch.Tensor,
153
+ attention_mask: Optional[torch.Tensor] = None,
154
+ ) -> torch.Tensor:
155
+ """Encode audio features.
156
+
157
+ Args:
158
+ input_features: Mel spectrogram features [batch, seq_len, feature_dim]
159
+ attention_mask: Optional attention mask [batch, seq_len]
160
+
161
+ Returns:
162
+ Audio embeddings [batch, encoded_seq_len, hidden_size]
163
+ """
164
+ outputs = self.encoder(
165
+ input_features=input_features,
166
+ attention_mask=attention_mask,
167
+ )
168
+ # Return the last hidden state
169
+ return outputs.last_hidden_state
170
+
171
+ @property
172
+ def hidden_size(self) -> int:
173
+ """Return the hidden size of the encoder."""
174
+ return self.config.hidden_size
chat_template.jinja ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {% macro render_extra_keys(json_dict, handled_keys) %}
2
+ {%- if json_dict is mapping %}
3
+ {%- for json_key in json_dict if json_key not in handled_keys %}
4
+ {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
5
+ {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
6
+ {%- else %}
7
+ {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
8
+ {%- endif %}
9
+ {%- endfor %}
10
+ {%- endif %}
11
+ {%- endmacro -%}
12
+ {%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}
13
+ {%- set reasoning_budget = reasoning_budget if reasoning_budget is defined else None %}
14
+ {%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}
15
+
16
+ {#- Scan messages for VLM thinking toggles to override enable_thinking -#}
17
+ {%- set toggle = namespace(enable=enable_thinking) %}
18
+ {%- for m in messages %}
19
+ {%- if m['role'] == 'user' or m['role'] == 'system' -%}
20
+ {%- if m['content'] is string -%}
21
+ {%- set c = m['content'] %}
22
+ {%- if '/think' in c.replace('</think>', '') -%}
23
+ {%- set toggle.enable = true -%}
24
+ {%- elif '/no_think' in c -%}
25
+ {%- set toggle.enable = false -%}
26
+ {%- endif -%}
27
+ {%- else -%}
28
+ {%- for part in m['content'] -%}
29
+ {%- if part['type'] == 'text' -%}
30
+ {%- set c = part['text'] %}
31
+ {%- if '/think' in c.replace('</think>', '') -%}
32
+ {%- set toggle.enable = true -%}
33
+ {%- elif '/no_think' in c -%}
34
+ {%- set toggle.enable = false -%}
35
+ {%- endif -%}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+ {%- endif -%}
39
+ {%- endif -%}
40
+ {%- endfor -%}
41
+ {#- Prepare message iteration similar to LM template -#}
42
+ {%- set ns = namespace(last_user_idx = -1) %}
43
+ {%- set loop_messages = messages %}
44
+ {%- for m in loop_messages %}
45
+ {%- if m["role"] == "user" %}
46
+ {%- set ns.last_user_idx = loop.index0 %}
47
+ {%- endif %}
48
+ {%- endfor -%}
49
+
50
+ {%- if messages[0]["role"] == "system" %}
51
+ {%- set system_message = messages[0]["content"] %}
52
+ {%- set loop_messages = messages[1:] %}
53
+ {%- else %}
54
+ {%- set system_message = "" %}
55
+ {%- set loop_messages = messages %}
56
+ {%- endif %}
57
+ {%- if not tools is defined %}
58
+ {%- set tools = [] %}
59
+ {%- endif %}
60
+ {#- Recompute last_user_idx relative to loop_messages after handling system -#}
61
+ {%- set ns = namespace(last_user_idx = -1) %}
62
+ {%- for m in loop_messages %}
63
+ {%- if m["role"] == "user" %}
64
+ {%- set ns.last_user_idx = loop.index0 %}
65
+ {%- endif %}
66
+ {%- endfor -%}
67
+ {#- System preamble with LM formatting, sanitize thinking toggles -#}
68
+ {%- if system_message is defined %}
69
+ {%- set sys_content = system_message | string %}
70
+ {%- set sys_content = sys_content.replace('</think>', '<_end_think>').replace('/think', '').replace('/no_think', '').replace('<_end_think>', '</think>') %}
71
+ {{- "<|im_start|>system\n" + sys_content }}
72
+ {%- else %}
73
+ {%- if tools is iterable and tools | length > 0 %}
74
+ {{- "<|im_start|>system\n" }}
75
+ {%- endif %}
76
+ {%- endif %}
77
+ {%- if tools is iterable and tools | length > 0 %}
78
+ {%- if system_message is defined and system_message | length > 0 %}
79
+ {{- "\n\n" }}
80
+ {%- endif %}
81
+ {{- "# Tools\n\nYou have access to the following functions:\n\n" }}
82
+ {{- "<tools>" }}
83
+ {%- for tool in tools %}
84
+ {%- if tool.function is defined %}
85
+ {%- set tool = tool.function %}
86
+ {%- endif %}
87
+ {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }}
88
+ {%- if tool.description is defined %}
89
+ {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }}
90
+ {%- endif %}
91
+ {{- '\n<parameters>' }}
92
+ {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
93
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
94
+ {{- '\n<parameter>' }}
95
+ {{- '\n<name>' ~ param_name ~ '</name>' }}
96
+ {%- if param_fields.type is defined %}
97
+ {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }}
98
+ {%- endif %}
99
+ {%- if param_fields.description is defined %}
100
+ {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
101
+ {%- endif %}
102
+ {%- if param_fields.enum is defined %}
103
+ {{- '\n<enum>' ~ (param_fields.enum | tojson | safe) ~ '</enum>' }}
104
+ {%- endif %}
105
+ {%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
106
+ {{- render_extra_keys(param_fields, handled_keys) }}
107
+ {{- '\n</parameter>' }}
108
+ {%- endfor %}
109
+ {%- endif %}
110
+ {%- set handled_keys = ['type', 'properties', 'required'] %}
111
+ {{- render_extra_keys(tool.parameters, handled_keys) }}
112
+ {%- if tool.parameters is defined and tool.parameters.required is defined %}
113
+ {{- '\n<required>' ~ (tool.parameters.required | tojson | safe) ~ '</required>' }}
114
+ {%- endif %}
115
+ {{- '\n</parameters>' }}
116
+ {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
117
+ {{- render_extra_keys(tool, handled_keys) }}
118
+ {{- '\n</function>' }}
119
+ {%- endfor %}
120
+ {{- "\n</tools>" }}
121
+
122
+ {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
123
+ {%- endif -%}
124
+ {%- if system_message is defined %}
125
+ {{- '<|im_end|>\n' }}
126
+ {%- else %}
127
+ {%- if tools is iterable and tools | length > 0 %}
128
+ {{- '<|im_end|>\n' }}
129
+ {%- endif %}
130
+ {%- endif -%}
131
+ {#- Iterate conversation -#}
132
+ {%- for message in loop_messages %}
133
+ {%- if message.role == "assistant" %}
134
+ {#- Use LM assistant handling -#}
135
+ {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}
136
+ {%- set content = "<think>\n" ~ message.reasoning_content ~ "\n</think>\n" ~ (message.content | default('', true)) %}
137
+ {%- else %}
138
+ {%- set content = message.content | default('', true) %}
139
+ {%- if content is string -%}
140
+ {%- if '<think>' not in content and '</think>' not in content -%}
141
+ {%- set content = "<think></think>" ~ content -%}
142
+ {%- endif -%}
143
+ {%- else -%}
144
+ {%- set content = content -%}
145
+ {%- endif -%}
146
+ {%- endif %}
147
+ {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
148
+ {{- '<|im_start|>assistant\n' }}
149
+ {%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
150
+ {%- if content is string and content | trim | length > 0 %}
151
+ {%- if include_content %}
152
+ {{- (content | trim) ~ '\n' -}}
153
+ {%- else %}
154
+ {%- set c = (content | string) %}
155
+ {%- if '</think>' in c %}
156
+ {%- set c = c.split('</think>')[-1] %}
157
+ {%- elif '<think>' in c %}
158
+ {%- set c = c.split('<think>')[0] %}
159
+ {%- endif %}
160
+ {%- set c = "<think></think>" ~ c | trim %}
161
+ {%- if c | length > 0 %}
162
+ {{- c ~ '\n' -}}
163
+ {%- endif %}
164
+ {%- endif %}
165
+ {%- else %}
166
+ {{- "<think></think>" -}}
167
+ {%- endif %}
168
+ {%- for tool_call in message.tool_calls %}
169
+ {%- if tool_call.function is defined %}
170
+ {%- set tool_call = tool_call.function %}
171
+ {%- endif %}
172
+ {{- '<tool_call>\n<function=' ~ tool_call.name ~ '>\n' -}}
173
+ {%- if tool_call.arguments is defined %}
174
+ {%- for args_name, args_value in tool_call.arguments|items %}
175
+ {{- '<parameter=' ~ args_name ~ '>\n' -}}
176
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
177
+ {{- args_value ~ '\n</parameter>\n' -}}
178
+ {%- endfor %}
179
+ {%- endif %}
180
+ {{- '</function>\n</tool_call>\n' -}}
181
+ {%- endfor %}
182
+ {{- '<|im_end|>\n' }}
183
+ {%- else %}
184
+ {%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
185
+ {{- '<|im_start|>assistant\n' ~ (content | default('', true) | string | trim) ~ '<|im_end|>\n' }}
186
+ {%- else %}
187
+ {%- set c = (content | default('', true) | string) %}
188
+ {%- if '<think>' in c and '</think>' in c %}
189
+ {%- set c = "<think></think>" ~ c.split('</think>')[-1] %}
190
+ {%- endif %}
191
+ {%- set c = c | trim %}
192
+ {%- if c | length > 0 %}
193
+ {{- '<|im_start|>assistant\n' ~ c ~ '<|im_end|>\n' }}
194
+ {%- else %}
195
+ {{- '<|im_start|>assistant\n<|im_end|>\n' }}
196
+ {%- endif %}
197
+ {%- endif %}
198
+ {%- endif %}
199
+ {%- elif message.role == "user" or message.role == "system" %}
200
+ {{- '<|im_start|>' + message.role + '\n' }}
201
+ {#- Build VLM multimodal content when content is a sequence -#}
202
+ {%- if message.content is string -%}
203
+ {%- set content = (message.content | string) %}
204
+ {%- else -%}
205
+ {%- set text_ns = namespace(val='') -%}
206
+ {%- set mm_content = '' -%}
207
+ {%- set counters = namespace(images=0, videos=0, audios=0) -%}
208
+ {%- for part in message['content'] -%}
209
+ {%- if part['type'] == 'image' or part['type'] == 'image_url' -%}
210
+ {%- set counters.images = counters.images + 1 -%}
211
+ {%- elif part['type'] == 'video' or part['type'] == 'video_url' -%}
212
+ {%- set counters.videos = counters.videos + 1 -%}
213
+ {%- elif part['type'] == 'audio' or part['type'] == 'audio_url' -%}
214
+ {%- set counters.audios = counters.audios + 1 -%}
215
+ {%- elif part['type'] == 'text' -%}
216
+ {%- set text_ns.val = text_ns.val + part['text'] -%}
217
+ {%- endif -%}
218
+ {%- endfor -%}
219
+ {%- if '<image>' in text_ns.val -%}
220
+ {%- set counters.images = 0 -%}
221
+ {%- endif -%}
222
+ {%- if '<video>' in text_ns.val -%}
223
+ {%- set counters.videos = 0 -%}
224
+ {%- endif -%}
225
+ {%- if '<so_embedding>' in text_ns.val -%}
226
+ {%- set counters.audios = 0 -%}
227
+ {%- endif -%}
228
+ {%- if counters.images > 1 -%}
229
+ {%- set image_tags = namespace(tags=[]) -%}
230
+ {%- for i in range(counters.images) -%}
231
+ {%- set image_tags.tags = image_tags.tags + ['<image ' + (i + 1)|string + '><image>'] -%}
232
+ {%- endfor -%}
233
+ {%- set mm_content = ' '.join(image_tags.tags) + '\n' -%}
234
+ {%- elif counters.images == 1 -%}
235
+ {%- set mm_content = '<image>\n' -%}
236
+ {%- endif -%}
237
+ {%- set mm_content = mm_content + '<video>\n' * counters.videos -%}
238
+ {%- set mm_content = mm_content + '<so_embedding>\n' * counters.audios -%}
239
+ {%- set content = mm_content + text_ns.val.lstrip('\n') -%}
240
+ {%- endif -%}
241
+ {#- Sanitize thinking toggle directives from user/system content -#}
242
+ {%- set content = content.replace('</think>', '<_end_think>').replace('/think', '').replace('/no_think', '').replace('<_end_think>', '</think>') -%}
243
+ {%- set content = content | trim -%}
244
+ {%- if message.role == "user" and loop.index0 == ns.last_user_idx and reasoning_budget is not none -%}
245
+ {{- content + '\n\n{thinking token budget: ' + (reasoning_budget | string) + '}' -}}
246
+ {%- else -%}
247
+ {{- content -}}
248
+ {%- endif -%}
249
+ {{- '<|im_end|>\n' }}
250
+ {%- elif message.role == "tool" %}
251
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
252
+ {{- '<|im_start|>user\n' }}
253
+ {%- endif %}
254
+ {{- '<tool_response>\n' }}
255
+ {{- message.content }}
256
+ {{- '\n</tool_response>\n' }}
257
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
258
+ {{- '<|im_end|>\n' }}
259
+ {%- elif loop.last %}
260
+ {{- '<|im_end|>\n' }}
261
+ {%- endif %}
262
+ {%- else %}
263
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>\n' }}
264
+ {%- endif %}
265
+ {%- endfor -%}
266
+ {#- Generation prompt using computed thinking toggle -#}
267
+ {%- if add_generation_prompt %}
268
+ {%- if toggle.enable %}
269
+ {{- '<|im_start|>assistant\n<think>\n' }}
270
+ {%- else %}
271
+ {{- '<|im_start|>assistant\n<think></think>' }}
272
+ {%- endif %}
273
+ {%- endif %}
config.json ADDED
The diff for this file is too large to render. See raw diff
 
configuration.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from transformers.configuration_utils import PretrainedConfig
15
+ from transformers.utils import logging
16
+ from .configuration_nemotron_h import NemotronHConfig
17
+ from .configuration_radio import RADIOConfig
18
+
19
+ logger = logging.get_logger(__name__)
20
+
21
+
22
+ class SoundConfig(PretrainedConfig):
23
+ """Configuration for the sound/audio model (Parakeet encoder + projection)."""
24
+ model_type = "parakeet"
25
+
26
+ def __init__(
27
+ self,
28
+ # Parakeet encoder config
29
+ hidden_size: int = 1024,
30
+ num_attention_heads: int = 8,
31
+ num_hidden_layers: int = 24,
32
+ intermediate_size: int = 4096,
33
+ conv_kernel_size: int = 31,
34
+ feat_in: int = 80, # Mel features
35
+ subsampling_factor: int = 8,
36
+ # Projection config
37
+ projection_hidden_size: int = 20480,
38
+ projection_bias: bool = True,
39
+ # Audio processing
40
+ sampling_rate: int = 16000,
41
+ **kwargs,
42
+ ):
43
+ super().__init__(**kwargs)
44
+ self.hidden_size = hidden_size
45
+ self.num_attention_heads = num_attention_heads
46
+ self.num_hidden_layers = num_hidden_layers
47
+ self.intermediate_size = intermediate_size
48
+ self.conv_kernel_size = conv_kernel_size
49
+ self.feat_in = feat_in
50
+ self.subsampling_factor = subsampling_factor
51
+ self.projection_hidden_size = projection_hidden_size
52
+ self.projection_bias = projection_bias
53
+ self.sampling_rate = sampling_rate
54
+
55
+
56
+ class NemotronH_Nano_Omni_Reasoning_V3_Config(PretrainedConfig):
57
+ model_type = 'NemotronH_Nano_Omni_Reasoning_V3'
58
+ is_composition = True
59
+
60
+ def __init__(
61
+ self,
62
+ vision_config=None,
63
+ llm_config=None,
64
+ sound_config=None,
65
+ force_image_size=None,
66
+ downsample_ratio=0.5,
67
+ template=None,
68
+ ps_version='v1',
69
+ image_tag_type="internvl",
70
+ projector_hidden_size=4096,
71
+ vit_hidden_size=1280,
72
+ attn_implementation="flash_attention_2",
73
+ video_pruning_rate: float = 0.0,
74
+ # Sound/audio settings
75
+ sound_context_token_id: int = None,
76
+ sound_context_token: str = "<audio>",
77
+ **kwargs
78
+ ):
79
+ super().__init__(**kwargs)
80
+
81
+ if vision_config is not None:
82
+ self.vision_config = RADIOConfig(**vision_config)
83
+ else:
84
+ self.vision_config = RADIOConfig()
85
+
86
+ # Handle both cases: when loading from JSON (llm_config is dict) and when called internally by transformers (llm_config is None)
87
+ if llm_config is not None:
88
+ self.llm_config = NemotronHConfig(**llm_config)
89
+ else:
90
+ self.llm_config = NemotronHConfig()
91
+
92
+ # Sound/audio model configuration
93
+ if sound_config is not None:
94
+ self.sound_config = SoundConfig(**sound_config)
95
+ else:
96
+ self.sound_config = None # Sound model is optional
97
+
98
+ # Assign configuration values
99
+ self.force_image_size = force_image_size
100
+ self.downsample_ratio = downsample_ratio
101
+ self.template = template # TODO move out of here and into the tokenizer
102
+ self.ps_version = ps_version # Pixel shuffle version
103
+ self.image_tag_type = image_tag_type # TODO: into the tokenizer too?
104
+ self.projector_hidden_size = projector_hidden_size
105
+ self.vit_hidden_size = vit_hidden_size
106
+ self.video_pruning_rate = video_pruning_rate
107
+
108
+ # Sound/audio token settings
109
+ self.sound_context_token_id = sound_context_token_id
110
+ self.sound_context_token = sound_context_token
111
+
112
+ self._attn_implementation = attn_implementation
113
+ self.vision_config.use_flash_attn = self._attn_implementation is not None and "flash_attention" in self._attn_implementation
114
+ self.llm_config._attn_implementation = self._attn_implementation
configuration_nemotron_h.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2024 AI21 Labs Ltd. and the HuggingFace Inc. team. All rights reserved.
3
+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+ """NemotronH model configuration"""
17
+
18
+ import re
19
+
20
+ from transformers.configuration_utils import PretrainedConfig
21
+ from transformers.utils import logging
22
+
23
+
24
+ logger = logging.get_logger(__name__)
25
+
26
+
27
+ class NemotronHConfig(PretrainedConfig):
28
+ r"""
29
+ This is the configuration class to store the configuration of a [`NemotronHModel`]. It is used to instantiate a
30
+ NemotronH model according to the specified arguments, defining the model architecture. Instantiating a configuration
31
+ with the defaults will yield a similar configuration to that of the NemotronH-v0.1 model.
32
+
33
+ [todo](todo)
34
+
35
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
36
+ documentation from [`PretrainedConfig`] for more information.
37
+
38
+
39
+ Args:
40
+ vocab_size (`int`, *optional*, defaults to 131072):
41
+ Vocabulary size of the NemotronH model. Defines the number of different tokens that can be represented by the
42
+ `inputs_ids` passed when calling [`NemotronHModel`]
43
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
44
+ Whether the model's input and output word embeddings should be tied. Note that this is only relevant if the
45
+ model has a output word embedding layer.
46
+ hidden_size (`int`, *optional*, defaults to 4096):
47
+ Dimension of the hidden representations.
48
+ intermediate_size (`int`, *optional*, defaults to 21504):
49
+ Dimension of the MLP representations.
50
+ num_hidden_layers (`int`, *optional*, defaults to 52):
51
+ Number of hidden layers in the Transformer encoder.
52
+ hybrid_override_pattern (`str`, *optional*, defaults to `"M-M-M-M*-M-M-M-M-M*-M-M-M-M-M*-M-M-M-M-M*-M-M-M-M-M-"`):
53
+ The pattern of the hybrid model. The pattern is a string of characters where each character represents M: Mamba2, *: Attention, -: MLP
54
+ num_attention_heads (`int`, *optional*, defaults to 32):
55
+ Number of attention heads for each attention layer in the Transformer encoder.
56
+ head_dim (`int`, *optional*, defaults to 128):
57
+ Dimension of each attention head.
58
+ num_key_value_heads (`int`, *optional*, defaults to 8):
59
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
60
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
61
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used.
62
+ mlp_hidden_act (`str`, *optional*, defaults to "relu2"):
63
+ The non-linear activation function in the MLP layers.
64
+ attention_bias (`bool`, *optional*, defaults to `False`):
65
+ Whether to use bias in attention layers.
66
+ mlp_bias (`bool`, *optional*, defaults to `False`):
67
+ Whether to use bias in MLP layers.
68
+ use_bias (`bool`, *optional*, defaults to `False`):
69
+ Whether to use bias in the model.
70
+ initializer_range (`float`, *optional*, defaults to 0.02):
71
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
72
+ layer_norm_epsilon (`float`, *optional*, defaults to 1e-5):
73
+ The epsilon used by the layer normalization layers.
74
+ residual_in_fp32 (`bool`, *optional*, defaults to `False`):
75
+ Whether or not residuals should be in `float32`. If set to `False` residuals will keep the same `dtype` as the rest of the model.
76
+ use_cache (`bool`, *optional*, defaults to `True`):
77
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
78
+ relevant if `config.is_decoder=True`.
79
+ num_logits_to_keep (`int` or `None`, *optional*, defaults to 1):
80
+ Number of prompt logits to calculate during generation. If `None`, all logits will be calculated. If an
81
+ integer value, only last `num_logits_to_keep` logits will be calculated.
82
+ pad_token_id (`int`, *optional*, defaults to 0):
83
+ The id of the padding token.
84
+ bos_token_id (`int`, *optional*, defaults to 1):
85
+ The id of the "beginning-of-sequence" token.
86
+ eos_token_id (`int`, *optional*, defaults to 2):
87
+ The id of the "end-of-sequence" token.
88
+ sliding_window (`int`, *optional*, defaults to None):
89
+ Sliding window attention window size.
90
+ max_position_embeddings (`int`, *optional*, defaults to 4096):
91
+ The maximum sequence length that this model might ever be used with.
92
+ attention_dropout (`float`, *optional*, defaults to 0.0):
93
+ The dropout ratio for the attention probabilities.
94
+ hidden_dropout (`float`, *optional*, defaults to 0.0):
95
+ The dropout ratio for the hidden states.
96
+ use_mamba_kernels (`bool`, *optional*, defaults to `True`):
97
+ Flag indicating whether or not to use the fast mamba kernels. These are available only if `mamba-ssm` and
98
+ `causal-conv1d` are installed, and the mamba modules are running on a CUDA device.
99
+ ssm_state_size (`int`, *optional*, defaults to 128):
100
+ The dimension of the mamba state space latents.
101
+ mamba_num_heads (`int`, *optional*, defaults to 128):
102
+ Number of heads in Mamba layers.
103
+ mamba_n_groups (`int`, *optional*, defaults to 8):
104
+ Number of groups in Mamba layers.
105
+ mamba_head_dim (`int`, *optional*, defaults to 64):
106
+ Dimension of each Mamba head.
107
+ mamba_d_conv (`int`, *optional*, defaults to 4):
108
+ The size of the mamba convolution kernel.
109
+ mamba_expand (`int`, *optional*, defaults to 2):
110
+ Expanding factor used to determine the mamba intermediate size.
111
+ mamba_hidden_act (`str`, *optional*, defaults to "silu"):
112
+ The non-linear activation function in the Mamba layers.
113
+ mamba_dt_min (`float`, *optional*, defaults to 0.001):
114
+ Minimum value for the time step in Mamba.
115
+ mamba_dt_max (`float`, *optional*, defaults to 0.1):
116
+ Maximum value for the time step in Mamba.
117
+ mamba_dt_limit (`tuple`, *optional*, defaults to (0.0, float("inf"))):
118
+ Limits for the time step in Mamba.
119
+ mamba_dt_init_floor (`float`, *optional*, defaults to 1e-4):
120
+ Floor value for time step initialization in Mamba.
121
+ mamba_conv_bias (`bool`, *optional*, defaults to `True`):
122
+ Whether to use bias in the convolution layer of the mamba mixer block.
123
+ mamba_proj_bias (`bool`, *optional*, defaults to `False`):
124
+ Whether to use bias in the input and output projections of the mamba mixer block.
125
+ mamba_chunk_size (`int`, *optional*, defaults to 256):
126
+ Size of chunks for Mamba processing.
127
+ rescale_prenorm_residual (`bool`, *optional*, defaults to `True`):
128
+ Whether to rescale the pre-normalization residual connections.
129
+ """
130
+
131
+ model_type = "nemotron_h"
132
+ keys_to_ignore_at_inference = ["past_key_values"]
133
+
134
+ def __init__(
135
+ self,
136
+ vocab_size=131072,
137
+ tie_word_embeddings=False,
138
+ hidden_size=4096,
139
+ intermediate_size=21504,
140
+ num_hidden_layers=52,
141
+ hybrid_override_pattern="M-M-M-M*-M-M-M-M-M*-M-M-M-M-M*-M-M-M-M-M*-M-M-M-M-M-",
142
+ num_attention_heads=32,
143
+ head_dim=128,
144
+ num_key_value_heads=8, # nemo: num_query_groups
145
+ mlp_hidden_act="relu2",
146
+ attention_bias=False,
147
+ mlp_bias=False,
148
+ use_bias=False,
149
+ initializer_range=0.02, # nemo: init_method_std
150
+ layer_norm_epsilon=1e-5, # nemo: layernorm_epsilon
151
+ residual_in_fp32=False, # Megatron Core default value
152
+ use_cache=True,
153
+ num_logits_to_keep=1,
154
+ pad_token_id=0,
155
+ bos_token_id=1,
156
+ eos_token_id=2,
157
+ sliding_window=None,
158
+ max_position_embeddings=4096,
159
+ attention_dropout=0.0,
160
+ hidden_dropout=0.0, # * ADDED
161
+ use_mamba_kernels=True,
162
+ ssm_state_size=128, # mamba_state_size
163
+ mamba_num_heads=128,
164
+ mamba_n_groups=8, # nemo: mamba_ssm_ngroups = num_heads
165
+ mamba_head_dim=64,
166
+ mamba_d_conv=4,
167
+ mamba_expand=2,
168
+ mamba_hidden_act="silu",
169
+ mamba_dt_min=0.001,
170
+ mamba_dt_max=0.1,
171
+ mamba_dt_limit=(0.0, float("inf")),
172
+ mamba_dt_init_floor=1e-4,
173
+ mamba_conv_bias=True,
174
+ mamba_proj_bias=False,
175
+ mamba_chunk_size=128,
176
+ rescale_prenorm_residual=True,
177
+ n_routed_experts=8,
178
+ n_shared_experts=1,
179
+ moe_intermediate_size=7688,
180
+ moe_shared_expert_intermediate_size=7688,
181
+ num_experts_per_tok=2,
182
+ routed_scaling_factor=1.0,
183
+ n_group=1,
184
+ topk_group=1,
185
+ norm_topk_prob=True,
186
+ **kwargs,
187
+ ):
188
+ self.vocab_size = vocab_size
189
+ self.tie_word_embeddings = tie_word_embeddings
190
+ self.hidden_size = hidden_size
191
+ self.intermediate_size = intermediate_size
192
+ self.num_hidden_layers = num_hidden_layers
193
+ self.hybrid_override_pattern = hybrid_override_pattern
194
+ self.num_attention_heads = num_attention_heads
195
+ self.head_dim = head_dim
196
+ self.sliding_window = sliding_window
197
+ self.max_position_embeddings = max_position_embeddings
198
+ self.attention_dropout = attention_dropout
199
+ self.hidden_dropout = hidden_dropout
200
+
201
+ # Validate hybrid_override_pattern
202
+ # M: Mamba2, *: Attention, -: MLP, E: MoE
203
+ assert len(self.hybrid_override_pattern) == self.num_hidden_layers, "hybrid_override_pattern must have the same length as num_hidden_layers"
204
+ assert re.match(r"^[*\-ME]+$", self.hybrid_override_pattern), "hybrid_override_pattern must only contain characters 'M', '*', '-', or 'E'"
205
+
206
+ # for backward compatibility
207
+ if num_key_value_heads is None:
208
+ num_key_value_heads = num_attention_heads
209
+
210
+ self.num_key_value_heads = num_key_value_heads
211
+ self.mlp_hidden_act = mlp_hidden_act
212
+ self.attention_bias = attention_bias
213
+ self.mlp_bias = mlp_bias
214
+ self.use_bias = use_bias
215
+ self.initializer_range = initializer_range
216
+ self.layer_norm_epsilon = layer_norm_epsilon
217
+ self.residual_in_fp32 = residual_in_fp32
218
+
219
+ self.use_cache = use_cache
220
+ self.num_logits_to_keep = num_logits_to_keep
221
+
222
+ self.use_mamba_kernels = use_mamba_kernels
223
+ self.n_groups = mamba_n_groups
224
+ self.mamba_head_dim = mamba_head_dim
225
+ self.ssm_state_size = ssm_state_size
226
+ self.mamba_num_heads = mamba_num_heads
227
+ self.conv_kernel = mamba_d_conv
228
+ self.expand = mamba_expand
229
+ self.mamba_hidden_act = mamba_hidden_act
230
+ self.time_step_min = mamba_dt_min
231
+ self.time_step_max = mamba_dt_max
232
+ self.time_step_limit = mamba_dt_limit
233
+ self.time_step_floor = mamba_dt_init_floor
234
+ self.use_conv_bias = mamba_conv_bias
235
+ self.mamba_proj_bias = mamba_proj_bias
236
+ self.chunk_size = mamba_chunk_size
237
+ self.rescale_prenorm_residual = rescale_prenorm_residual
238
+ self.n_routed_experts = n_routed_experts
239
+ self.n_shared_experts = n_shared_experts
240
+ self.moe_intermediate_size = moe_intermediate_size
241
+ self.moe_shared_expert_intermediate_size = moe_shared_expert_intermediate_size
242
+ self.num_experts_per_tok = num_experts_per_tok
243
+ self.routed_scaling_factor = routed_scaling_factor
244
+ self.n_group = n_group
245
+ self.topk_group = topk_group
246
+ self.norm_topk_prob = norm_topk_prob
247
+
248
+ super().__init__(
249
+ pad_token_id=pad_token_id,
250
+ bos_token_id=bos_token_id,
251
+ eos_token_id=eos_token_id,
252
+ tie_word_embeddings=tie_word_embeddings,
253
+ **kwargs,
254
+ )
255
+
256
+ @property
257
+ def layers_block_type(self):
258
+ return [
259
+ "mamba" if self.hybrid_override_pattern[i] == "M" else
260
+ "attention" if self.hybrid_override_pattern[i] == "*" else
261
+ "mlp" if self.hybrid_override_pattern[i] == "-" else "moe"
262
+ for i in range(self.num_hidden_layers)]
configuration_radio.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
2
+ #
3
+ # NVIDIA CORPORATION and its licensors retain all intellectual property
4
+ # and proprietary rights in and to this software, related documentation
5
+ # and any modifications thereto. Any use, reproduction, disclosure or
6
+ # distribution of this software and related documentation without an express
7
+ # license agreement from NVIDIA CORPORATION is strictly prohibited.
8
+
9
+ from dataclasses import dataclass
10
+ from typing import Optional, NamedTuple, Union, List, Dict
11
+
12
+ from transformers import PretrainedConfig
13
+
14
+
15
+ class Resolution(NamedTuple):
16
+ height: int
17
+ width: int
18
+
19
+
20
+ @dataclass
21
+ class RadioResource:
22
+ url: str
23
+ patch_size: int
24
+ max_resolution: int
25
+ preferred_resolution: Resolution
26
+ vitdet_num_windowed: Optional[int] = None
27
+ vitdet_num_global: Optional[int] = None
28
+
29
+
30
+ RESOURCE_MAP = {
31
+ # RADIOv2.5
32
+ "radio_v2.5-b": RadioResource(
33
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio-v2.5-b_half.pth.tar?download=true",
34
+ patch_size=16,
35
+ max_resolution=2048,
36
+ preferred_resolution=(768, 768),
37
+ vitdet_num_global=4,
38
+ ),
39
+ "radio_v2.5-l": RadioResource(
40
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio-v2.5-l_half.pth.tar?download=true",
41
+ patch_size=16,
42
+ max_resolution=2048,
43
+ preferred_resolution=(768, 768),
44
+ vitdet_num_global=4,
45
+ ),
46
+ "radio_v2.5-h": RadioResource(
47
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.5-h.pth.tar?download=true",
48
+ patch_size=16,
49
+ max_resolution=2048,
50
+ preferred_resolution=(768, 768),
51
+ vitdet_num_global=4,
52
+ ),
53
+ "radio_v2.5-h-norm": RadioResource(
54
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.5-h-norm.pth.tar?download=true",
55
+ patch_size=16,
56
+ max_resolution=2048,
57
+ preferred_resolution=(768, 768),
58
+ vitdet_num_global=4,
59
+ ),
60
+ "radio_v2.5-g": RadioResource(
61
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.5-g.pth.tar?download=true",
62
+ patch_size=14,
63
+ max_resolution=1792,
64
+ preferred_resolution=(896, 896),
65
+ vitdet_num_global=8,
66
+ ),
67
+ # RADIO
68
+ "radio_v2.1": RadioResource(
69
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.1_bf16.pth.tar?download=true",
70
+ patch_size=16,
71
+ max_resolution=2048,
72
+ preferred_resolution=Resolution(432, 432),
73
+ vitdet_num_windowed=5,
74
+ ),
75
+ "radio_v2": RadioResource(
76
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v2.pth.tar?download=true",
77
+ patch_size=16,
78
+ max_resolution=2048,
79
+ preferred_resolution=Resolution(432, 432),
80
+ vitdet_num_windowed=5,
81
+ ),
82
+ "radio_v1": RadioResource(
83
+ "https://huggingface.co/nvidia/RADIO/resolve/main/radio_v1.pth.tar?download=true",
84
+ patch_size=14,
85
+ max_resolution=1050,
86
+ preferred_resolution=Resolution(378, 378),
87
+ ),
88
+ # E-RADIO
89
+ "e-radio_v2": RadioResource(
90
+ "https://huggingface.co/nvidia/RADIO/resolve/main/eradio_v2.pth.tar?download=true",
91
+ patch_size=16,
92
+ max_resolution=2048,
93
+ preferred_resolution=Resolution(512, 512),
94
+ ),
95
+ # C-RADIO
96
+ "c-radio_v2.5-g": RadioResource(
97
+ "https://huggingface.co/nvidia/C-RADIOv2-g/resolve/main/c-radio_v2-g_half.pth.tar",
98
+ patch_size=16,
99
+ max_resolution=2048,
100
+ preferred_resolution=(768, 768),
101
+ vitdet_num_global=8,
102
+ ),
103
+ "c-radio_v3-l": RadioResource(
104
+ # NOTE: Currently, this model cannot be loaded via TorchHub. Instead, use the transformers API at https://huggingface.co/nvidia/C-RADIOv3-L
105
+ # and accept the license terms.
106
+ "https://huggingface.co/nvidia/C-RADIOv3-L/resolve/main/c-radio-v3_l_half.pth.tar?download=true",
107
+ patch_size=16,
108
+ max_resolution=2048,
109
+ preferred_resolution=Resolution(512, 512),
110
+ ),
111
+ }
112
+
113
+ DEFAULT_VERSION = "radio_v2.5-h"
114
+
115
+
116
+ class RADIOConfig(PretrainedConfig):
117
+ """Pretrained Hugging Face configuration for RADIO models."""
118
+
119
+ def __init__(
120
+ self,
121
+ args: Optional[dict] = None,
122
+ version: Optional[str] = DEFAULT_VERSION,
123
+ patch_size: Optional[int] = None,
124
+ max_resolution: Optional[int] = None,
125
+ preferred_resolution: Optional[Resolution] = None,
126
+ adaptor_names: Union[str, List[str]] = None,
127
+ adaptor_configs: Dict[str, Dict[str, int]] = None,
128
+ vitdet_window_size: Optional[int] = None,
129
+ feature_normalizer_config: Optional[dict] = None,
130
+ inter_feature_normalizer_config: Optional[dict] = None,
131
+ **kwargs,
132
+ ):
133
+ self.args = args
134
+ for field in ["dtype", "amp_dtype"]:
135
+ if self.args is not None and field in self.args:
136
+ # Convert to a string in order to make it serializable.
137
+ # For example for torch.float32 we will store "float32",
138
+ # for "bfloat16" we will store "bfloat16".
139
+ self.args[field] = str(args[field]).split(".")[-1]
140
+ self.version = version
141
+ resource = RESOURCE_MAP[version]
142
+ self.patch_size = patch_size or resource.patch_size
143
+ self.max_resolution = max_resolution or resource.max_resolution
144
+ self.preferred_resolution = (
145
+ preferred_resolution or resource.preferred_resolution
146
+ )
147
+ self.adaptor_names = adaptor_names
148
+ self.adaptor_configs = adaptor_configs
149
+ self.vitdet_window_size = vitdet_window_size
150
+ self.feature_normalizer_config = feature_normalizer_config
151
+ self.inter_feature_normalizer_config = inter_feature_normalizer_config
152
+ super().__init__(**kwargs)
evs.py ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from typing import Tuple
3
+
4
+ class EfficientVideoSampling:
5
+ @staticmethod
6
+ def compute_retention_mask(
7
+ *,
8
+ video_embeds: torch.FloatTensor,
9
+ thw: torch.LongTensor,
10
+ spatial_merge_size: int,
11
+ q: float,
12
+ ):
13
+ """
14
+ Computes the retention mask for video embeddings based on the grid dimensions.
15
+
16
+ Args:
17
+ video_embeds (`torch.FloatTensor` of shape `(T * H * W, hidden_size)`):
18
+ The video embeddings to compute the retention mask for.
19
+ thw (`torch.LongTensor` of shape `(3)`):
20
+ The temporal, height and width of feature shape of each video in LLM.
21
+ spatial_merge_size (`int`): The spatial merge size of the video embeddings.
22
+ If embeddings will be downsampled *later*, this should be the downsampling factor.
23
+ q: (`float`): Pruning rate factor, indicating number of tokens to prune (remove)
24
+
25
+ Returns:
26
+ `torch.Tensor`: The retention mask for the video embeddings (T * H * W).
27
+ 1 for tokens to keep, 0 for tokens to prune.
28
+ """
29
+ T, H, W = thw
30
+
31
+ # video_embeds = einops.rearrange(
32
+ # video_embeds,
33
+ # "(T H W) C -> T H W C",
34
+ # T=T,
35
+ # H=H // spatial_merge_size,
36
+ # W=W // spatial_merge_size,
37
+ # )
38
+ # Use reshape instead of einops to avoid graph breaks
39
+ video_embeds = video_embeds.reshape(
40
+ T, H // spatial_merge_size, W // spatial_merge_size, video_embeds.size(-1)
41
+ )
42
+
43
+ # Core EVS
44
+ similarity = torch.nn.functional.cosine_similarity(
45
+ video_embeds[1:, ...], video_embeds[:-1, ...], dim=-1
46
+ )
47
+ dissimilarity = 1 - similarity
48
+
49
+ # Always ensure we include all tokens from the first frame
50
+ dissimilarity = torch.cat(
51
+ [255 * torch.ones_like(video_embeds[:1, :, :, 0]), dissimilarity], dim=0
52
+ )
53
+ dissimilarity_flat = dissimilarity.view(-1)
54
+
55
+ min_num_tokens = (H // spatial_merge_size) * (W // spatial_merge_size) # a single frame
56
+ evs_num_tokens = int(T * min_num_tokens * (1 - q))
57
+ num_tokens_to_keep = max(min_num_tokens, evs_num_tokens)
58
+
59
+ order = torch.argsort(dissimilarity_flat,
60
+ dim=-1,
61
+ descending=True,
62
+ stable=True)
63
+ topk_indices = order[:num_tokens_to_keep]
64
+
65
+ retention_mask = torch.zeros_like(dissimilarity_flat, dtype=torch.bool)
66
+ retention_mask[topk_indices] = True
67
+ retention_mask = retention_mask.reshape(dissimilarity.size())
68
+
69
+ # print(
70
+ # f"Computed retention mask of shape {retention_mask.shape=} with sparsity {retention_mask.float().mean().item():.4f} for {q=}",
71
+ # )
72
+ mask = retention_mask.view(-1) # "T H W -> (T H W)"
73
+ return mask
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": [2, 11],
5
+ "pad_token_id": 0,
6
+ "do_sample": true,
7
+ "temperature": 0.6,
8
+ "top_p": 0.95,
9
+ "max_new_tokens": 16384,
10
+ "reasoning_budget": 16384,
11
+ "reasoning_grace": 512,
12
+ "repetition_penalty": 1.0,
13
+ "transformers_version": "4.55.4"
14
+ }
hf_quant_config.json ADDED
The diff for this file is too large to render. See raw diff
 
image_processing.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional, Union, Any, Dict
2
+
3
+ from PIL import Image
4
+ import torch
5
+ from transformers.image_processing_base import BatchFeature
6
+ from transformers.image_processing_utils_fast import BaseImageProcessorFast, divide_to_patches
7
+ from transformers.image_utils import (make_list_of_images, get_image_size,
8
+ get_image_type, ImageInput, ImageType, ChannelDimension)
9
+ from transformers.utils import TensorType
10
+ import torchvision.transforms as T
11
+
12
+
13
+
14
+ class NemotronH_Nano_Omni_Reasoning_V3ImageProcessor(BaseImageProcessorFast):
15
+ model_input_names = ["pixel_values"]
16
+
17
+ def __init__(self, image_size=512, max_num_tiles=12, use_thumbnail=True, norm_mean=None, norm_std=None, do_rescale=True, patch_size=16, downsample_ratio=0.5, **kwargs):
18
+ super().__init__(**kwargs)
19
+ self.image_size = image_size
20
+ self.max_num_tiles = max_num_tiles
21
+ self.use_thumbnail = use_thumbnail
22
+ self.norm_mean = norm_mean
23
+ self.norm_std = norm_std
24
+ self.do_rescale = do_rescale
25
+ self.num_image_token = int((image_size // patch_size) ** 2 * (downsample_ratio ** 2))
26
+
27
+ def _process_image(
28
+ self,
29
+ image: ImageInput,
30
+ **kwargs,
31
+ ) -> torch.Tensor:
32
+ image_type = get_image_type(image)
33
+ if image_type == ImageType.PIL:
34
+ if image.mode != 'RGB':
35
+ image = image.convert('RGB')
36
+ image = T.ToTensor()(image)
37
+ return image
38
+
39
+ def _preprocess(
40
+ self,
41
+ images: List[torch.Tensor],
42
+ image_size: int = None,
43
+ max_num_tiles: int = None,
44
+ use_thumbnail: bool = None,
45
+ do_rescale: bool = None,
46
+ return_tensors: Optional[Union[str, TensorType]] = None,
47
+ **kwargs,
48
+ ) -> List[torch.Tensor]:
49
+ image_size = image_size if image_size is not None else self.image_size
50
+ max_num_tiles = max_num_tiles if max_num_tiles is not None else self.max_num_tiles
51
+ use_thumbnail = use_thumbnail if use_thumbnail is not None else self.use_thumbnail
52
+ do_rescale = do_rescale if do_rescale is not None else self.do_rescale
53
+
54
+ images = make_list_of_images(images)
55
+
56
+ all_patches = []
57
+ num_patches = []
58
+ for image in images:
59
+ patches = dynamic_preprocess(image, image_size, max_num_tiles, use_thumbnail)
60
+ all_patches.extend(patches)
61
+ num_patches.append(len(patches))
62
+
63
+ pixel_values = torch.stack(all_patches, dim=0)
64
+ norm_mean = torch.Tensor(self.norm_mean).view(1, 3, 1, 1)
65
+ norm_std = torch.Tensor(self.norm_std).view(1, 3, 1, 1)
66
+ pixel_values = (pixel_values - norm_mean) / norm_std
67
+ return BatchFeature(data={"pixel_values": pixel_values, "num_patches": num_patches}, tensor_type=return_tensors)
68
+
69
+
70
+ def get_internvl_target_ratios(
71
+ min_num: int,
72
+ max_num: int,
73
+ ) -> list[tuple[int, int]]:
74
+ target_ratios = {(i, j)
75
+ for n in range(min_num, max_num + 1)
76
+ for i in range(1, n + 1)
77
+ for j in range(1, n + 1) if min_num <= i * j <= max_num}
78
+ return sorted(target_ratios, key=lambda x: x[0] * x[1])
79
+
80
+
81
+ # From https://github.com/OpenGVLab/InternVL/blob/c62fa4f7c850165d7386bdc48ac6bc5a6fab0864/internvl_chat/internvl/train/dataset.py#L685
82
+ # Copyright (c) 2023 OpenGVLab.
83
+ def find_closest_aspect_ratio(
84
+ aspect_ratio: float,
85
+ target_ratios: list[tuple[int, int]],
86
+ width: int,
87
+ height: int,
88
+ image_size: int,
89
+ ) -> tuple[int, int]:
90
+ best_ratio_diff = float("inf")
91
+ best_ratio = (1, 1)
92
+ area = width * height
93
+ for ratio in target_ratios:
94
+ target_aspect_ratio = ratio[0] / ratio[1]
95
+ ratio_diff = abs(aspect_ratio - target_aspect_ratio)
96
+ if ratio_diff < best_ratio_diff:
97
+ best_ratio_diff = ratio_diff
98
+ best_ratio = ratio
99
+ elif ratio_diff == best_ratio_diff:
100
+ if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:
101
+ best_ratio = ratio
102
+ return best_ratio
103
+
104
+
105
+ def calculate_targets(
106
+ orig_width: int,
107
+ orig_height: int,
108
+ target_ratios: list[tuple[int, int]],
109
+ image_size: int,
110
+ ) -> tuple[int, int, int]:
111
+ aspect_ratio = orig_width / orig_height
112
+
113
+ # find the closest aspect ratio to the target
114
+ target_aspect_ratio = find_closest_aspect_ratio(
115
+ aspect_ratio,
116
+ target_ratios,
117
+ width=orig_width,
118
+ height=orig_height,
119
+ image_size=image_size,
120
+ )
121
+
122
+ # calculate the target width and height
123
+ target_width = image_size * target_aspect_ratio[0]
124
+ target_height = image_size * target_aspect_ratio[1]
125
+ blocks = target_aspect_ratio[0] * target_aspect_ratio[1]
126
+
127
+ return blocks, target_width, target_height
128
+
129
+
130
+ def dynamic_preprocess(image, image_size=512, max_num_tiles=12, use_thumbnail=True):
131
+ orig_height, orig_width = get_image_size(image, channel_dim=ChannelDimension.FIRST)
132
+ target_ratios = get_internvl_target_ratios(1, max_num_tiles)
133
+
134
+ blocks, target_width, target_height = calculate_targets(
135
+ orig_width,
136
+ orig_height,
137
+ target_ratios,
138
+ image_size
139
+ )
140
+ # resize the image
141
+ resized_img = T.Resize((target_height, target_width), interpolation=T.InterpolationMode.BICUBIC)(image)
142
+ patches = divide_to_patches(resized_img, image_size)
143
+ assert len(patches) == blocks
144
+ if use_thumbnail and len(patches) != 1:
145
+ thumbnail_img = T.Resize((image_size, image_size), interpolation=T.InterpolationMode.BICUBIC)(image)
146
+ patches.append(thumbnail_img)
147
+
148
+ return patches
model-lm-00000.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9f3af499b4c0cb30895da4f03b15e4e2c830bb3611a32992174fc5f9476af78
3
+ size 743427376
model-lm-00001.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5c0d5e27ba33f0c3200c811c2f5692410e53e0a50a13d20079f4ca2c642f1df
3
+ size 731121536
model-lm-00002.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c3d70aaf2778ddba74c1a823576aed897638477200eb8e973e427cc836bca696
3
+ size 38784120
model-lm-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88b0fa0fc6e5bc9ed1c1d91c4c3d070c8775d69a805510f9e3467a213fe79384
3
+ size 731121536
model-lm-00004.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98e7a7cde6e6bf799dc565bb993c81265010d494fbd7227d051ab7238dc66438
3
+ size 38784120
model-lm-00005.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0c04f4870be9538becb6cf2dc4031af8fc4ed0f43ef8a3cda2e6b9069e60b5da
3
+ size 46798952
model-lm-00006.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:942d096467f659714b848ece369444f44da4efd72ca17d310f1b5a4e683163ec
3
+ size 731121536
model-lm-00007.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ccc5b4f2529c6a20dbf0a47d306d48e0b646e1e550f76e4b7a3ee38dfc16f2a2
3
+ size 38784120
model-lm-00008.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a1ee8c710d27a99ad395180af1cdb82be9813dc945fb574b7ea13f993ffbb6b
3
+ size 731121536
model-lm-00009.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf875675df08b717b9924de8048d10c09cfb0a56e8a11d1bc90fc1cfff32c859
3
+ size 38784120
model-lm-00010.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fd6c9931ccfed80f00d89cb97705b9178880401fa9c541e6ae0e729007890fb
3
+ size 731122312
model-lm-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9dafdb7c89d53ca0565ca14030512174c31e03fa2a075352d5195300eb791c43
3
+ size 38784128
model-lm-00012.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc61bd883be853844d6e741e25b223c2db164422d91af890a97724d868b8565b
3
+ size 46798960
model-lm-00013.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b650001085bcc3be68ffd47dffff62c5f60f49ef415e08c4025d84daa05ee2d7
3
+ size 731122312
model-lm-00014.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b35036638fb9b459c24924e6a1033a3443f2f6efb329cae0fe2d6a8939844603
3
+ size 38784128
model-lm-00015.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69ce75e9ca97da3f7c3f51c0d236cccd5929fdc11fc2c0c2fc38588bb5d97327
3
+ size 731122312
model-lm-00016.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1a2dbf2ed2e8fe5a7a867e030f1f4f4e911be8226f8ce5c7d0a8502bb0e3bfb4
3
+ size 38784128
model-lm-00017.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00ab5e1cb48989aa56a1f5f29abade96c4a45eceb712b9b0327e360276f174a8
3
+ size 731122312
model-lm-00018.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ddd42ea3fad64779baae013f34b25031cd3a9fd32d8fb931341fdcb7b15afd1d
3
+ size 38784128
model-lm-00019.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8655c90c2ada6e8326840ddd8b39c851d22b18f7139fd7164b8e94766cc7acef
3
+ size 46798960
model-lm-00020.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba66fa32a4ecae79030cc7c3cdf4f0ecab7beee07d03c0c2b3b7b2a9bb6b8ef0
3
+ size 731122312
model-lm-00021.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db89967ea1bdf29ef784b3b3bc00f0ab33c848f969cf1eb00d3012e45372d267
3
+ size 38784128
model-lm-00022.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:354e6f50d3f915c5107772600aaa64d99e3be8c9e34968f344ca8b7ca8ad191e
3
+ size 731122312
model-lm-00023.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7e631303ba302cefb512a37e0b81a8b8d923d3081b0ef59904846693be248a2
3
+ size 38784128
model-lm-00024.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72f723726d2b2b6c7d63fbde81b25e56c9d04fed6bd4ce5ca180158ddadb83b1
3
+ size 731122312
model-lm-00025.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:50803a63db51b753509904c621c095b5ef176443b656b8fc55bc092e0a69db0e
3
+ size 38784128
model-lm-00026.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bef8ac9c2b2f43d0ed4165b7020e64272e6c9224458a11e0f6961b00f48f7f24
3
+ size 46798960
model-lm-00027.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46bf7ae3d22136da150d348abc8c867ce15f2e75a4773b16d24070d3deea30a7
3
+ size 731122312
model-lm-00028.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c4f689109a653295146049d2a013d343659f255468ea469f0f3609f799f179f
3
+ size 38784128
model-lm-00029.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30452ed27255dbb8a50f39b4b9bac10c9fb32a801dc88812b5d082a285acc3c1
3
+ size 731122312
model-lm-00030.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:611862ea391e5ce73045a0c65527aa7fec4b4d01ea6da55c732dadcb4c5d973a
3
+ size 38784128
model-lm-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4764c09380c89550a83cb4774af2310bf4a75870400eff3f1282ee732c8843c
3
+ size 731122312
model-lm-00032.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bef7fce4690b7d515ee083c4778c83ef5d9953f330899fa894170ecc7a01260
3
+ size 38784128
model-lm-00033.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b70e6e16d4fe6a7d7f89d941be647946d6a68feb55827cbdf2c93a43ab0e534
3
+ size 46798960
model-lm-00034.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:92508517b0b47b87c0e10a6a5cb28925b65f25ca128dbedc39a91a4a4633067f
3
+ size 731122312
model-lm-00035.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c022a3fa8a5e0536e20e11ffb9825ad0d878d4674c350601cec74fd0bae91d4
3
+ size 38784128
model-lm-00036.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3e522cf75166ef83747153ff01c3bf17b1d6799d41fc12fe559901143d0f0331
3
+ size 731122312
model-lm-00037.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:86e46624d7f7c72e4a88b1cdad70de7dc0fa1295473251089f3d1f812ddcc369
3
+ size 38784128
model-lm-00038.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79fc589b86210b4a85599bea126d5da3f23376af5418537d2bccd7edce78d20b
3
+ size 731122312