Instructions to use nvidia/Nemotron-Flash-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nvidia/Nemotron-Flash-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nvidia/Nemotron-Flash-3B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("nvidia/Nemotron-Flash-3B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nvidia/Nemotron-Flash-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nvidia/Nemotron-Flash-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Nemotron-Flash-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nvidia/Nemotron-Flash-3B
- SGLang
How to use nvidia/Nemotron-Flash-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "nvidia/Nemotron-Flash-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Nemotron-Flash-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "nvidia/Nemotron-Flash-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nvidia/Nemotron-Flash-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nvidia/Nemotron-Flash-3B with Docker Model Runner:
docker model run hf.co/nvidia/Nemotron-Flash-3B
Delete configuration_jamba.py
Browse files- configuration_jamba.py +0 -429
configuration_jamba.py
DELETED
|
@@ -1,429 +0,0 @@
|
|
| 1 |
-
# coding=utf-8
|
| 2 |
-
# Copyright 2024 AI21 Labs Ltd. and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
-
#
|
| 4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
-
# you may not use this file except in compliance with the License.
|
| 6 |
-
# You may obtain a copy of the License at
|
| 7 |
-
#
|
| 8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
-
#
|
| 10 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
-
# See the License for the specific language governing permissions and
|
| 14 |
-
# limitations under the License.
|
| 15 |
-
""" Jamba model configuration"""
|
| 16 |
-
import math
|
| 17 |
-
|
| 18 |
-
from transformers.configuration_utils import PretrainedConfig
|
| 19 |
-
from transformers.utils import logging
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
logger = logging.get_logger(__name__)
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
class JambaConfig(PretrainedConfig):
|
| 26 |
-
r"""
|
| 27 |
-
This is the configuration class to store the configuration of a [`JambaModel`]. It is used to instantiate a
|
| 28 |
-
Jamba model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
| 29 |
-
with the defaults will yield a similar configuration to that of the jamba-small architecture.
|
| 30 |
-
|
| 31 |
-
[ai21labs/jamba-small](https://huggingface.co/ai21labs/Jamba-v0.1)
|
| 32 |
-
|
| 33 |
-
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 34 |
-
documentation from [`PretrainedConfig`] for more information.
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
Args:
|
| 38 |
-
vocab_size (`int`, *optional*, defaults to 65536):
|
| 39 |
-
Vocabulary size of the Jamba model. Defines the number of different tokens that can be represented by the
|
| 40 |
-
`inputs_ids` passed when calling [`JambaModel`]
|
| 41 |
-
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 42 |
-
Whether the model's input and output word embeddings should be tied. Note that this is only relevant if the
|
| 43 |
-
model has a output word embedding layer.
|
| 44 |
-
hidden_size (`int`, *optional*, defaults to 4096):
|
| 45 |
-
Dimension of the hidden representations.
|
| 46 |
-
intermediate_size (`int`, *optional*, defaults to 14336):
|
| 47 |
-
Dimension of the MLP representations.
|
| 48 |
-
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 49 |
-
Number of hidden layers in the Transformer encoder.
|
| 50 |
-
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 51 |
-
Number of attention heads for each attention layer in the Transformer encoder.
|
| 52 |
-
num_key_value_heads (`int`, *optional*, defaults to 8):
|
| 53 |
-
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 54 |
-
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 55 |
-
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 56 |
-
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 57 |
-
by meanpooling all the original heads within that group. For more details checkout [this
|
| 58 |
-
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to `8`.
|
| 59 |
-
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 60 |
-
The non-linear activation function (function or string) in the decoder.
|
| 61 |
-
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 62 |
-
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 63 |
-
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 64 |
-
The epsilon used by the rms normalization layers.
|
| 65 |
-
use_cache (`bool`, *optional*, defaults to `True`):
|
| 66 |
-
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 67 |
-
relevant if `config.is_decoder=True`.
|
| 68 |
-
calc_logits_for_entire_prompt (`bool`, *optional*, defaults to `False`):
|
| 69 |
-
Whether or not to calculate logits for entire prompt during generation. If `False`, only the logits of the
|
| 70 |
-
last prompt token will be calculated, which are the only logits needed for generation. For long sequences,
|
| 71 |
-
the logits for the entire sequence may use a lot of memory so setting `calc_logits_for_entire_prompt=False`
|
| 72 |
-
will reduce memory footprint significantly.
|
| 73 |
-
Note: some generation features may not be available if this is set to `False`.
|
| 74 |
-
output_router_logits (`bool`, *optional*, defaults to `False`):
|
| 75 |
-
Whether or not the router logits should be returned by the model. Enabling this will also
|
| 76 |
-
allow the model to output the auxiliary loss. See [here]() for more details
|
| 77 |
-
router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
|
| 78 |
-
The aux loss factor for the total loss.
|
| 79 |
-
pad_token_id (`int`, *optional*, defaults to 0):
|
| 80 |
-
The id of the padding token.
|
| 81 |
-
bos_token_id (`int`, *optional*, defaults to 1):
|
| 82 |
-
The id of the "beginning-of-sequence" token.
|
| 83 |
-
eos_token_id (`int`, *optional*, defaults to 2):
|
| 84 |
-
The id of the "end-of-sequence" token.
|
| 85 |
-
sliding_window (`int`, *optional*):
|
| 86 |
-
Sliding window attention window size. If not specified, will default to `None`.
|
| 87 |
-
n_ctx (`int`, *optional*, defaults to 262144):
|
| 88 |
-
This value doesn't have any real effect. The maximum sequence length that this model is intended to be
|
| 89 |
-
used with. It can be used with longer sequences, but performance may degrade.
|
| 90 |
-
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 91 |
-
The dropout ratio for the attention probabilities.
|
| 92 |
-
num_experts_per_tok (`int`, *optional*, defaults to 2):
|
| 93 |
-
The number of experts to root per-token, can be also interpreted as the `top-p` routing
|
| 94 |
-
parameter
|
| 95 |
-
num_experts (`int`, *optional*, defaults to 16):
|
| 96 |
-
Number of experts per Sparse MLP layer.
|
| 97 |
-
expert_layer_period (`int`, *optional*, defaults to 2):
|
| 98 |
-
Once in this many layers, we will have an expert layer
|
| 99 |
-
expert_layer_offset (`int`, *optional*, defaults to 1):
|
| 100 |
-
The first layer index that contains an expert mlp layer
|
| 101 |
-
attn_layer_period (`int`, *optional*, defaults to 8):
|
| 102 |
-
Once in this many layers, we will have a vanilla attention layer
|
| 103 |
-
attn_layer_offset (`int`, *optional*, defaults to 4):
|
| 104 |
-
The first layer index that contains a vanilla attention mlp layer
|
| 105 |
-
use_mamba_kernels (`bool`, *optional*, defaults to `True`):
|
| 106 |
-
Flag indicating whether or not to use the fast mamba kernels. These are available only if `mamba-ssm` and
|
| 107 |
-
`causal-conv1d` are installed, and the mamba modules are running on a CUDA device. Raises ValueError if
|
| 108 |
-
`True` and kernels are not available
|
| 109 |
-
mamba_d_state (`int`, *optional*, defaults to 16):
|
| 110 |
-
The dimension the mamba state space latents
|
| 111 |
-
mamba_d_conv (`int`, *optional*, defaults to 4):
|
| 112 |
-
The size of the mamba convolution kernel
|
| 113 |
-
mamba_expand (`int`, *optional*, defaults to 2):
|
| 114 |
-
Expanding factor (relative to hidden_size) used to determine the mamba intermediate size
|
| 115 |
-
mamba_dt_rank (`Union[int,str]`, *optional*, defaults to `"auto"`):
|
| 116 |
-
Rank of the the mamba discretization projection matrix. `"auto"` means that it will default to `math.ceil(self.hidden_size / 16)`
|
| 117 |
-
mamba_conv_bias (`bool`, *optional*, defaults to `True`):
|
| 118 |
-
Flag indicating whether or not to use bias in the convolution layer of the mamba mixer block.
|
| 119 |
-
mamba_proj_bias (`bool`, *optional*, defaults to `False`):
|
| 120 |
-
Flag indicating whether or not to use bias in the input and output projections (["in_proj", "out_proj"]) of the mamba mixer block
|
| 121 |
-
mamba_inner_layernorms (`bool`, *optional*, defaults to `True`):
|
| 122 |
-
Flag indicating whether or not to apply layernorms to internal mamba activations
|
| 123 |
-
|
| 124 |
-
"""
|
| 125 |
-
|
| 126 |
-
model_type = "jamba"
|
| 127 |
-
keys_to_ignore_at_inference = ["past_key_values"]
|
| 128 |
-
|
| 129 |
-
def __init__(
|
| 130 |
-
self,
|
| 131 |
-
vocab_size=65536,
|
| 132 |
-
tie_word_embeddings=False,
|
| 133 |
-
hidden_size=4096,
|
| 134 |
-
intermediate_size=14336,
|
| 135 |
-
num_hidden_layers=32,
|
| 136 |
-
num_attention_heads=32,
|
| 137 |
-
num_key_value_heads=8,
|
| 138 |
-
hidden_act="silu",
|
| 139 |
-
initializer_range=0.02,
|
| 140 |
-
rms_norm_eps=1e-6,
|
| 141 |
-
use_cache=True,
|
| 142 |
-
calc_logits_for_entire_prompt=False,
|
| 143 |
-
output_router_logits=False,
|
| 144 |
-
router_aux_loss_coef=0.001,
|
| 145 |
-
pad_token_id=0,
|
| 146 |
-
bos_token_id=1,
|
| 147 |
-
eos_token_id=2,
|
| 148 |
-
sliding_window=None,
|
| 149 |
-
max_position_embeddings=262144,
|
| 150 |
-
orig_max_position_embeddings=None,
|
| 151 |
-
attention_dropout=0.0,
|
| 152 |
-
num_experts_per_tok=2,
|
| 153 |
-
num_experts=16,
|
| 154 |
-
expert_layer_period=2,
|
| 155 |
-
expert_layer_offset=1,
|
| 156 |
-
attn_layer_period=8,
|
| 157 |
-
attn_layer_offset=4,
|
| 158 |
-
use_mamba_kernels=True,
|
| 159 |
-
mamba_d_state=16,
|
| 160 |
-
mamba_d_conv=4,
|
| 161 |
-
mamba_expand=2,
|
| 162 |
-
mamba_dt_rank="auto",
|
| 163 |
-
mamba_conv_bias=True,
|
| 164 |
-
mamba_proj_bias=False,
|
| 165 |
-
mamba_inner_layernorms=True,
|
| 166 |
-
|
| 167 |
-
hybrid_decoder_layer='mamba',
|
| 168 |
-
share_kv=False,
|
| 169 |
-
double_v_dim=False,
|
| 170 |
-
compact_gating=False,
|
| 171 |
-
kv_reuse_every_i_layer=-1,
|
| 172 |
-
kv_reuse_group=None,
|
| 173 |
-
kv_weight_reuse=False,
|
| 174 |
-
|
| 175 |
-
num_ffn=1,
|
| 176 |
-
ffn_reuse_every_i_layer=-1,
|
| 177 |
-
attn_reuse_every_i_layer=-1,
|
| 178 |
-
mamba_reuse_every_i_layer=-1,
|
| 179 |
-
|
| 180 |
-
macro_arch='',
|
| 181 |
-
|
| 182 |
-
lookback_mode='',
|
| 183 |
-
|
| 184 |
-
shared_module_attn='',
|
| 185 |
-
shared_module_mamba='',
|
| 186 |
-
|
| 187 |
-
ffn_sharing_config=None,
|
| 188 |
-
|
| 189 |
-
sliding_window_size=None,
|
| 190 |
-
global_attn_idx=None,
|
| 191 |
-
|
| 192 |
-
num_mamba=1,
|
| 193 |
-
mamba_latent_size=None,
|
| 194 |
-
|
| 195 |
-
public_ffn_structure=False,
|
| 196 |
-
num_attn_per_ffn=3,
|
| 197 |
-
dense_public_ffn_structure=False,
|
| 198 |
-
|
| 199 |
-
local_global_dual_branch=False,
|
| 200 |
-
local_expand_ratio=1,
|
| 201 |
-
local_global_dual_branch_merge_op='mean',
|
| 202 |
-
|
| 203 |
-
mamba_multihead_config=None,
|
| 204 |
-
|
| 205 |
-
moe_config=None,
|
| 206 |
-
|
| 207 |
-
enable_mod=False,
|
| 208 |
-
mod_topk=2,
|
| 209 |
-
|
| 210 |
-
sequential_jamba=False,
|
| 211 |
-
fully_parallel_jamba=False,
|
| 212 |
-
|
| 213 |
-
attn_implementation_new='sdpa',
|
| 214 |
-
|
| 215 |
-
fused_multihead_config=None,
|
| 216 |
-
|
| 217 |
-
compute_attn_mat=False,
|
| 218 |
-
visual_attn=False,
|
| 219 |
-
save_input_output=False,
|
| 220 |
-
|
| 221 |
-
use_mamba2=False,
|
| 222 |
-
mamba2_headdim=64,
|
| 223 |
-
|
| 224 |
-
swa_full_head=False,
|
| 225 |
-
|
| 226 |
-
gradient_checkpoint_layer=None,
|
| 227 |
-
|
| 228 |
-
rope_type=None,
|
| 229 |
-
|
| 230 |
-
visual_entropy=False,
|
| 231 |
-
|
| 232 |
-
use_nemotron5=False,
|
| 233 |
-
|
| 234 |
-
use_nGPT=False,
|
| 235 |
-
nGPT_mode=None,
|
| 236 |
-
nGPT_config=None,
|
| 237 |
-
|
| 238 |
-
mamba_attnaug_config=None,
|
| 239 |
-
|
| 240 |
-
no_dt_bias=False,
|
| 241 |
-
|
| 242 |
-
hash_grid_config=None,
|
| 243 |
-
|
| 244 |
-
hash_grid_config_mlp=None,
|
| 245 |
-
|
| 246 |
-
repeat_ffn=None,
|
| 247 |
-
|
| 248 |
-
layer_types=None,
|
| 249 |
-
|
| 250 |
-
supernet_config=None,
|
| 251 |
-
|
| 252 |
-
pure_linear_attn=False,
|
| 253 |
-
|
| 254 |
-
self_attn_type=None,
|
| 255 |
-
|
| 256 |
-
other_args=None,
|
| 257 |
-
|
| 258 |
-
ffn_expand_ratio=None,
|
| 259 |
-
|
| 260 |
-
d_conv=4,
|
| 261 |
-
|
| 262 |
-
layerwise_memory_token=False,
|
| 263 |
-
|
| 264 |
-
**kwargs,
|
| 265 |
-
):
|
| 266 |
-
self.vocab_size = vocab_size
|
| 267 |
-
self.tie_word_embeddings = tie_word_embeddings
|
| 268 |
-
self.hidden_size = hidden_size
|
| 269 |
-
self.intermediate_size = intermediate_size
|
| 270 |
-
self.num_hidden_layers = num_hidden_layers
|
| 271 |
-
self.num_attention_heads = num_attention_heads
|
| 272 |
-
self.sliding_window = sliding_window
|
| 273 |
-
self.max_position_embeddings = max_position_embeddings
|
| 274 |
-
self.orig_max_position_embeddings = orig_max_position_embeddings
|
| 275 |
-
self.attention_dropout = attention_dropout
|
| 276 |
-
|
| 277 |
-
# for backward compatibility
|
| 278 |
-
if num_key_value_heads is None:
|
| 279 |
-
num_key_value_heads = num_attention_heads
|
| 280 |
-
|
| 281 |
-
self.num_key_value_heads = num_key_value_heads
|
| 282 |
-
self.hidden_act = hidden_act
|
| 283 |
-
self.initializer_range = initializer_range
|
| 284 |
-
self.rms_norm_eps = rms_norm_eps
|
| 285 |
-
|
| 286 |
-
self.use_cache = use_cache
|
| 287 |
-
self.calc_logits_for_entire_prompt = calc_logits_for_entire_prompt
|
| 288 |
-
self.output_router_logits = output_router_logits
|
| 289 |
-
self.router_aux_loss_coef = router_aux_loss_coef
|
| 290 |
-
|
| 291 |
-
self.num_experts_per_tok = num_experts_per_tok
|
| 292 |
-
self.num_experts = num_experts
|
| 293 |
-
self.expert_layer_period = expert_layer_period
|
| 294 |
-
self.expert_layer_offset = expert_layer_offset
|
| 295 |
-
self.attn_layer_period = attn_layer_period
|
| 296 |
-
self.attn_layer_offset = attn_layer_offset
|
| 297 |
-
|
| 298 |
-
self.use_mamba_kernels = use_mamba_kernels
|
| 299 |
-
self.mamba_d_state = mamba_d_state
|
| 300 |
-
self.mamba_d_conv = mamba_d_conv
|
| 301 |
-
self.mamba_expand = mamba_expand
|
| 302 |
-
self.mamba_dt_rank = math.ceil(self.hidden_size / 16) if mamba_dt_rank == "auto" else mamba_dt_rank
|
| 303 |
-
self.mamba_conv_bias = mamba_conv_bias
|
| 304 |
-
self.mamba_proj_bias = mamba_proj_bias
|
| 305 |
-
self.mamba_inner_layernorms = mamba_inner_layernorms
|
| 306 |
-
|
| 307 |
-
# added by Xin
|
| 308 |
-
self.reduce_method = kwargs.pop("reduce_method", "mean")
|
| 309 |
-
self.hybrid_block_indices = kwargs.pop("hybrid_block_indices", [])
|
| 310 |
-
self.reduce_attn_ratio = kwargs.pop("reduce_attn_ratio", 0.5)
|
| 311 |
-
self.attn_hidden_size = kwargs.pop("attn_hidden_size", -1)
|
| 312 |
-
self.kq_head_dim = kwargs.pop("kq_head_dim", -1)
|
| 313 |
-
self.v_head_dim = kwargs.pop("v_head_dim", -1)
|
| 314 |
-
self.kq_norm = kwargs.pop("kq_norm", None)
|
| 315 |
-
self.rope = kwargs.pop("rope", False)
|
| 316 |
-
self.rope_theta = kwargs.pop("rope_theta", 10000.0)
|
| 317 |
-
self.num_memory_tokens = kwargs.pop("num_memory_tokens", 0)
|
| 318 |
-
self.memory_tokens_interspersed_every = kwargs.pop("memory_tokens_interspersed_every", 0)
|
| 319 |
-
|
| 320 |
-
#! adhoc change
|
| 321 |
-
self.new_seq_length = 2048
|
| 322 |
-
self.visual_entropy = kwargs.pop("visual_entropy", False)
|
| 323 |
-
|
| 324 |
-
self.hybrid_decoder_layer = hybrid_decoder_layer
|
| 325 |
-
self.share_kv = share_kv
|
| 326 |
-
self.double_v_dim = double_v_dim
|
| 327 |
-
self.compact_gating = compact_gating
|
| 328 |
-
self.kv_reuse_every_i_layer = kv_reuse_every_i_layer
|
| 329 |
-
self.kv_reuse_group = kv_reuse_group
|
| 330 |
-
self.kv_weight_reuse = kv_weight_reuse
|
| 331 |
-
|
| 332 |
-
self.num_ffn = num_ffn
|
| 333 |
-
self.ffn_reuse_every_i_layer = ffn_reuse_every_i_layer
|
| 334 |
-
self.attn_reuse_every_i_layer = attn_reuse_every_i_layer
|
| 335 |
-
self.mamba_reuse_every_i_layer = mamba_reuse_every_i_layer
|
| 336 |
-
|
| 337 |
-
self.macro_arch = macro_arch
|
| 338 |
-
|
| 339 |
-
self.lookback_mode = lookback_mode
|
| 340 |
-
|
| 341 |
-
self.shared_module_attn = shared_module_attn
|
| 342 |
-
self.shared_module_mamba = shared_module_mamba
|
| 343 |
-
|
| 344 |
-
self.ffn_sharing_config = ffn_sharing_config
|
| 345 |
-
|
| 346 |
-
self.sliding_window_size = sliding_window_size
|
| 347 |
-
self.global_attn_idx = global_attn_idx
|
| 348 |
-
|
| 349 |
-
self.num_mamba = num_mamba
|
| 350 |
-
|
| 351 |
-
self.mamba_latent_size = mamba_latent_size
|
| 352 |
-
|
| 353 |
-
self.public_ffn_structure = public_ffn_structure
|
| 354 |
-
self.num_attn_per_ffn = num_attn_per_ffn
|
| 355 |
-
self.dense_public_ffn_structure = dense_public_ffn_structure
|
| 356 |
-
|
| 357 |
-
self.local_global_dual_branch = local_global_dual_branch
|
| 358 |
-
self.local_expand_ratio = local_expand_ratio
|
| 359 |
-
self.local_global_dual_branch_merge_op = local_global_dual_branch_merge_op
|
| 360 |
-
|
| 361 |
-
self.mamba_multihead_config = mamba_multihead_config
|
| 362 |
-
|
| 363 |
-
self.moe_config = moe_config
|
| 364 |
-
|
| 365 |
-
self.enable_mod = enable_mod
|
| 366 |
-
self.mod_topk = mod_topk
|
| 367 |
-
|
| 368 |
-
self.sequential_jamba = sequential_jamba
|
| 369 |
-
self.fully_parallel_jamba = fully_parallel_jamba
|
| 370 |
-
|
| 371 |
-
self.attn_implementation_new = attn_implementation_new
|
| 372 |
-
|
| 373 |
-
self.fused_multihead_config = fused_multihead_config
|
| 374 |
-
|
| 375 |
-
self.compute_attn_mat = compute_attn_mat
|
| 376 |
-
self.visual_attn = visual_attn
|
| 377 |
-
self.save_input_output = save_input_output
|
| 378 |
-
|
| 379 |
-
self.use_mamba2 = use_mamba2
|
| 380 |
-
self.mamba2_headdim = mamba2_headdim
|
| 381 |
-
|
| 382 |
-
self.swa_full_head = swa_full_head
|
| 383 |
-
|
| 384 |
-
self.gradient_checkpoint_layer = gradient_checkpoint_layer
|
| 385 |
-
|
| 386 |
-
self.rope_type = rope_type
|
| 387 |
-
|
| 388 |
-
self.visual_entropy = visual_entropy
|
| 389 |
-
|
| 390 |
-
self.use_nemotron5 = use_nemotron5
|
| 391 |
-
|
| 392 |
-
self.use_nGPT = use_nGPT
|
| 393 |
-
self.nGPT_mode = nGPT_mode
|
| 394 |
-
|
| 395 |
-
self.mamba_attnaug_config = mamba_attnaug_config
|
| 396 |
-
|
| 397 |
-
self.no_dt_bias = no_dt_bias
|
| 398 |
-
|
| 399 |
-
self.nGPT_config = nGPT_config
|
| 400 |
-
|
| 401 |
-
self.hash_grid_config = hash_grid_config
|
| 402 |
-
|
| 403 |
-
self.hash_grid_config_mlp = hash_grid_config_mlp
|
| 404 |
-
|
| 405 |
-
self.repeat_ffn = repeat_ffn
|
| 406 |
-
|
| 407 |
-
self.layer_types = layer_types
|
| 408 |
-
|
| 409 |
-
self.supernet_config = supernet_config
|
| 410 |
-
|
| 411 |
-
self.pure_linear_attn = pure_linear_attn
|
| 412 |
-
|
| 413 |
-
self.self_attn_type = self_attn_type
|
| 414 |
-
|
| 415 |
-
self.other_args = other_args
|
| 416 |
-
|
| 417 |
-
self.ffn_expand_ratio = ffn_expand_ratio
|
| 418 |
-
|
| 419 |
-
self.d_conv = d_conv
|
| 420 |
-
|
| 421 |
-
self.layerwise_memory_token = layerwise_memory_token
|
| 422 |
-
|
| 423 |
-
super().__init__(
|
| 424 |
-
pad_token_id=pad_token_id,
|
| 425 |
-
bos_token_id=bos_token_id,
|
| 426 |
-
eos_token_id=eos_token_id,
|
| 427 |
-
tie_word_embeddings=tie_word_embeddings,
|
| 428 |
-
**kwargs,
|
| 429 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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