MCPcopy Create free account
hub / github.com/OpenSparseLLMs/Linear-MoE / set_input_tensor

Method set_input_tensor

linear_moe/model/mixtral/model.py:143–157  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected