nemo_automodel.components.models.flint
nemo_automodel.components.models.flint
Flint architecture configuration and native causal language model.
Submodules
nemo_automodel.components.models.flint.confignemo_automodel.components.models.flint.layersnemo_automodel.components.models.flint.maginemo_automodel.components.models.flint.modelnemo_automodel.components.models.flint.packingnemo_automodel.components.models.flint.parallelizationnemo_automodel.components.models.flint.state_dict_adapter
Package Contents
Classes
API
Bases: PreTrainedConfig
Architecture settings matching the source Flint checkpoint.
The local class removes dependence on checkpoint remote code. Full layers
have no RoPE; sliding layers rotate all head channels with NeoX RoPE. The
window counts the current token. router_aux_loss_coef is preserved as
checkpoint metadata; the native training implementation requires an explicit
zero value until the original auxiliary objective is specified.
attention_compute_dtype='fp16' is an explicit TE-only QKV/kernel-output
boundary within otherwise FP32 projection compute. It does not change the
bulk parameter dtype or enable autocast. Small-gradient training requires an
appropriate loss-scaling policy; the default None retains native precision.
Resolve schedules and upstream RoPE fields, then validate the contract.
Construct a native model without changing these declarative settings.
Parameters:
Runtime kernel choices; defaults to the verified eager/torch path.
Returns: FlintForCausalLM
An initialized native causal language model.
Validate the preserved source schedule independently of active prefix depth.
Bases: HFCheckpointingMixin, PreTrainedModel, MoEFSDPSyncMixin
Eager Flint baseline, with protected trainable sinks and untied FP32 head.
CPU FP32 correctness is the initial supported execution contract. GPU precision, inference caches, packed sequences and distributed axes require their own validation before being advertised.
Identify a real partial stage using retained modules and active depth.
Return FP32 logits for full-sequence, padded causal language modeling.
Parameters:
Integer [batch, sequence], THD [tokens], or floating CP-local [batch, sequence, hidden] residuals on later PP stages.
Binary [batch, sequence] validity, or nonnegative integer document IDs for eager/SDPA packed attention.
Optional integer tensor [batch, sequence].
Alternative floating tensor [batch, sequence, hidden].
Optional unshifted HF-style labels [batch, sequence], with -100 ignored. This path shifts once. Production calculate_loss consumes already shifted labels separately and must not pass them here.
True is unsupported by this full-sequence training baseline.
Inference cache; only None is supported.
Include all [batch, sequence, hidden] states, except logits_to_keep=1 selects the final FP32 hidden tensor for the shared linear-loss contract without retaining every layer.
Zero projects all positions; a positive value projects that many final positions. Labels require all positions.
Return only final FP32 hidden states for an external already-shifted linear loss; do not run the vocabulary projection.
Boolean [batch, sequence] or THD [tokens], True for physically padded expert rows; document lengths own its meaning.
Shared TE THD boundaries/formats or a model-owned Magi plan. PP stage-zero global IDs are selected by prepared local indices once; later stages already receive local residuals.
Returns: CausalLMOutputWithPast | torch.Tensor
CausalLMOutputWithPast with FP32 logits [batch, selected_sequence, vocab],
Construct the native model through the config-owned build boundary.
Parameters:
Local architecture settings.
Runtime kernel choices.
Returns: FlintForCausalLM
Initialized native model, without loading any checkpoint weights.
Reject the inherited HF loader, which cannot convert native MoE layouts.
Parameters:
Source checkpoint directory or Hub ID.
Upstream loader positional arguments.
Upstream loader arguments.
Returns: FlintForCausalLM
No model; use NeMoAutoModelForCausalLM.from_pretrained instead.
Raises:
ValueError: Always, with the adapter-aware public entry point.
Return the independently trainable input embedding module.
Returns: nn.Embedding
Embedding with weight [vocab, hidden], with no frozen padding row.
Return the separate FP32 vocabulary projection module.
Returns: nn.Linear
Bias-free linear module with weight [vocab, hidden].
Describe PP token/residual/logit boundaries without a probe forward.
Parameters:
Whether this is the first physical stage.
Number of rows in one PP microbatch.
Global sequence extent, including dataset physical padding.
Framework-selected bulk compute dtype.
Returns: tuple[torch.Tensor, ...]
Input/output meta tuples: global int64 IDs [B,S] on stage zero,
Initialize every trainable family after construction or meta materialization.
Parameters:
Optional bulk parameter dtype; sinks and the head stay FP32. Installed PEFT adapters retain their explicitly selected dtype.
Prepare global [B,S] tokens and [B,N] document lengths before PP splitting.
Parameters:
Global token, target and position tensors; packed batches include real/padded document lengths and qkv_format=‘thd’.
Independent PP microbatch token spaces.
Returns: dict[str, Any]
Model-owned shared sharder and padding metadata; local coordinates
Preserve the fixed vocabulary used by checkpoint conversion.
Parameters:
Vocabulary resizing is not supported by this baseline.
Vocabulary padding is not supported.
Upstream initialization option, unused without resizing.
Returns: nn.Embedding
Existing embedding [vocab, hidden] when no resize is requested.
Raises:
ValueError: A vocabulary resize or padding operation is requested.
Replace the input module without changing the output-head parameter.
Parameters:
Embedding module with weight [vocab, hidden].
Replace the output module under the protected-FP32 contract.
Parameters:
Bias-free linear module with FP32 weight [vocab, hidden].