MCPcopy Create free account
hub / github.com/SooLab/CGFormer / get_input_embeddings

Method get_input_embeddings

bert/modeling_utils.py:310–322  ·  view source on GitHub ↗

Returns the model's input embeddings. Returns: :obj:`nn.Module`: A torch module mapping vocabulary to hidden states.

(self)

Source from the content-addressed store, hash-verified

308 return getattr(self, self.base_model_prefix, self)
309
310 def get_input_embeddings(self):
311 """
312 Returns the model's input embeddings.
313
314 Returns:
315 :obj:`nn.Module`:
316 A torch module mapping vocabulary to hidden states.
317 """
318 base_model = getattr(self, self.base_model_prefix, self)
319 if base_model is not self:
320 return base_model.get_input_embeddings()
321 else:
322 raise NotImplementedError
323
324 def set_input_embeddings(self, value: nn.Module):
325 """

Callers 2

tie_weightsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected