nemo_automodel.components.models.qwen2.model
nemo_automodel.components.models.qwen2.model
Custom Qwen2 model implementation for NeMo Automodel.
This module provides a self-contained Qwen2 implementation with separate HuggingFace-style q/k/v and gate/up projections.
Example (YAML):
Module Contents
Classes
Data
API
Bases: Module
Multi-headed attention with separate QKV projections — HuggingFace default layout.
Bases: GradientCheckpointingLayer
Single Qwen2 decoder layer with RMSNorm, attention, and MLP.
Bases: HFCheckpointingMixin, Qwen2PreTrainedModel
Qwen2 model with causal language modeling head.
Uses separate q/k/v and gate/up projections — HuggingFace layout.
Forward pass returning CausalLMOutputWithPast.
Bases: Qwen2PreTrainedModel
Qwen2 transformer model (embeddings + decoder layers + norm).
Bases: PreTrainedModel
Abstract class for Qwen2 pretrained models.
Bases: Module
SwiGLU MLP with separate gate_proj and up_proj — identical to HuggingFace default.