MCPcopy Create free account
hub / github.com/zai-org/CodeGeeX / __init__

Method __init__

codegeex/torch/codegeex_model.py:689–707  ·  view source on GitHub ↗
(
        self,
        hidden_size,
        vocab_size,
        max_sequence_length,
    )

Source from the content-addressed store, hash-verified

687 """
688
689 def __init__(
690 self,
691 hidden_size,
692 vocab_size,
693 max_sequence_length,
694 ):
695 super(Embedding, self).__init__()
696 self.hidden_size = hidden_size
697 self.vocab_size = vocab_size
698 self.max_sequence_length = max_sequence_length
699
700 # Word embeddings.
701 self.word_embeddings = torch.nn.Embedding(self.vocab_size, self.hidden_size)
702 self._word_embeddings_key = 'word_embeddings'
703
704 # Position embedding.
705 self.position_embeddings = torch.nn.Embedding(self.max_sequence_length, self.hidden_size)
706 self.position_embeddings = self.position_embeddings.half()
707 self._position_embeddings_key = 'position_embeddings'
708
709 def forward(self, input_ids, position_ids):
710 # Embeddings.

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected