(self, config: LlamaConfig)
| 921 | """ |
| 922 | |
| 923 | def __init__(self, config: LlamaConfig): |
| 924 | super().__init__(config) |
| 925 | self.padding_idx = config.pad_token_id |
| 926 | self.vocab_size = config.vocab_size |
| 927 | |
| 928 | self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx) |
| 929 | self.layers = nn.ModuleList( |
| 930 | [LlamaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)] |
| 931 | ) |
| 932 | self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps) |
| 933 | self.rotary_emb = LlamaRotaryEmbedding(config=config) |
| 934 | self.gradient_checkpointing = False |
| 935 | |
| 936 | # Initialize weights and apply final processing |
| 937 | self.post_init() |
| 938 | |
| 939 | def get_input_embeddings(self): |
| 940 | return self.embed_tokens |
nothing calls this directly
no test coverage detected