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

Method _init_weights

train/patch/modeling_llama.py:825–834  ·  view source on GitHub ↗
(self, module)

Source from the content-addressed store, hash-verified

823 _supports_static_cache = True
824
825 def _init_weights(self, module):
826 std = self.config.initializer_range
827 if isinstance(module, nn.Linear):
828 module.weight.data.normal_(mean=0.0, std=std)
829 if module.bias is not None:
830 module.bias.data.zero_()
831 elif isinstance(module, nn.Embedding):
832 module.weight.data.normal_(mean=0.0, std=std)
833 if module.padding_idx is not None:
834 module.weight.data[module.padding_idx].zero_()
835
836
837LLAMA_INPUTS_DOCSTRING = r"""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected