Sets input tensor to the model. See megatron.model.transformer.set_input_tensor() Args: input_tensor (Tensor): Sets the input tensor for the model.
(self, input_tensor: Tensor)
| 141 | self.setup_embeddings_and_output_layer() |
| 142 | |
| 143 | def set_input_tensor(self, input_tensor: Tensor) -> None: |
| 144 | """Sets input tensor to the model. |
| 145 | |
| 146 | See megatron.model.transformer.set_input_tensor() |
| 147 | |
| 148 | Args: |
| 149 | input_tensor (Tensor): Sets the input tensor for the model. |
| 150 | """ |
| 151 | # This is usually handled in schedules.py but some inference code still |
| 152 | # gives us non-lists or None |
| 153 | if not isinstance(input_tensor, list): |
| 154 | input_tensor = [input_tensor] |
| 155 | |
| 156 | assert len(input_tensor) == 1, 'input_tensor should only be length 1 for gpt/bert' |
| 157 | self.decoder.set_input_tensor(input_tensor[0]) |
| 158 | |
| 159 | def forward( |
| 160 | self, |
nothing calls this directly
no outgoing calls
no test coverage detected