MCPcopy Create free account
hub / github.com/THUDM/LongWriter / __init__

Method __init__

train/patch/modeling_llama.py:711–721  ·  view source on GitHub ↗
(self, config: LlamaConfig, layer_idx: int)

Source from the content-addressed store, hash-verified

709
710class LlamaDecoderLayer(nn.Module):
711 def __init__(self, config: LlamaConfig, layer_idx: int):
712 super().__init__()
713 self.hidden_size = config.hidden_size
714
715 config._attn_implementation = "longwriter"
716 self.self_attn = LLAMA_ATTENTION_CLASSES[config._attn_implementation](config=config, layer_idx=layer_idx)
717 # print(config._attn_implementation)
718
719 self.mlp = LlamaMLP(config)
720 self.input_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
721 self.post_attention_layernorm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
722
723 def forward(
724 self,

Callers

nothing calls this directly

Calls 3

LlamaMLPClass · 0.85
LlamaRMSNormClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected