bridge.diffusion.models.llada15.llada15_provider#
LLaDA15ModelProvider: GPTModelProvider with bidirectional core attention.
Module Contents#
Classes#
GPTModelProvider for LLaDA1.5 masked-diffusion dense models. |
Functions#
Build a TE GPT layer spec and swap in |
API#
- bridge.diffusion.models.llada15.llada15_provider._llada15_layer_spec(
- config: LLaDA15ModelProvider,
Build a TE GPT layer spec and swap in
LLaDA15TEDotProductAttention.Injecting the custom core attention is the single change required versus a vanilla TE GPT layer: it forces bidirectional attention (
no_mask) so the model matches LLaDA1.5’s reference implementation, which uses a zero attention bias at every forward pass.
- class bridge.diffusion.models.llada15.llada15_provider.LLaDA15ModelProvider#
Bases:
megatron.bridge.models.gpt_provider.GPTModelProviderGPTModelProvider for LLaDA1.5 masked-diffusion dense models.
Differences vs a vanilla Llama GPTModelProvider:
transformer_layer_specis overridden so every self-attention layer usesLLaDA15TEDotProductAttention, which forces bidirectional attention (the reference implementation uses zero attention bias everywhere — seemodeling_llada.py:get_bidirectional_attention_bias).share_embeddings_and_output_weightsdefaults toFalsebecause LLaDA1.5 hasweight_tying: falsein its HF config — the LM head lives atmodel.transformer.ff_out.
Full RoPE is handled by Megatron’s standard rotary path (the HF reference rotates the full
head_dimwith a standard rotate-half pattern), soposition_embedding_typestays at its default"rope"value.- transformer_layer_spec: Union[megatron.core.transformer.ModuleSpec, Callable]#
None
False
- position_embedding_type: str#
‘rope’