mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Optimize transformer encoder/decoder init suggestion (#146882)
Fixes #72253 Add hint message for users to manually initialize after created. ## Test Result **Before**   **After**   Pull Request resolved: https://github.com/pytorch/pytorch/pull/146882 Approved by: https://github.com/jbschlosser
This commit is contained in:
parent
1e92579126
commit
4b0cf9fc00
|
|
@ -314,6 +314,10 @@ class TransformerEncoder(Module):
|
|||
|
||||
Users can build the BERT(https://arxiv.org/abs/1810.04805) model with corresponding parameters.
|
||||
|
||||
.. warning::
|
||||
All layers in the TransformerEncoder are initialized with the same parameters.
|
||||
It is recommended to manually initialize the layers after creating the TransformerEncoder instance.
|
||||
|
||||
Args:
|
||||
encoder_layer: an instance of the TransformerEncoderLayer() class (required).
|
||||
num_layers: the number of sub-encoder-layers in the encoder (required).
|
||||
|
|
@ -535,6 +539,10 @@ class TransformerDecoder(Module):
|
|||
for an in depth discussion of the performant building blocks PyTorch offers for building your own
|
||||
transformer layers.
|
||||
|
||||
.. warning::
|
||||
All layers in the TransformerDecoder are initialized with the same parameters.
|
||||
It is recommended to manually initialize the layers after creating the TransformerDecoder instance.
|
||||
|
||||
Args:
|
||||
decoder_layer: an instance of the TransformerDecoderLayer() class (required).
|
||||
num_layers: the number of sub-decoder-layers in the decoder (required).
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user