def vocab_expansion(self, task_vocab):
        """ Expand the model's vocabulary with pretrained word embeddings.

        Args:
            task_vocab(list): Vocabulary for each task.
        """

        self.task_word2id = {"<s>": 0, "<pad>": 1, "</s>": 2, "<unk>": 3}

        self.task_id2word = {0: "<s>", 1: "<pad>", 2: "</s>", 3: "<unk>"}

        ctr = 4
        for idx, word in enumerate(task_vocab):
            if word not in self.task_word2id:
                self.task_word2id[word] = ctr
                self.task_id2word[ctr] = word
                ctr += 1

        if not self.vocab_expanded:
            self.first_expansion()

        # Expand vocabulary using the linear regression model
        task_embeddings = []
        oov_pretrain = 0
        oov_task = 0

        for word in self.task_id2word.values():
            if word in self.word2id:
                task_embeddings.append(
                    self.model_embedding_matrix[self.word2id[word]]
                )
            elif word in self.pretrain_word2id:
                oov_task += 1
                task_embeddings.append(
                    self.lreg.predict(
                        self.pretrained_embedding_matrix[
                            self.pretrain_word2id[word]
                        ].reshape(1, -1)
                    )
                    .squeeze()
                    .astype(np.float32)
                )
            else:
                oov_pretrain += 1
                oov_task += 1
                task_embeddings.append(
                    self.model_embedding_matrix[self.word2id["<unk>"]]
                )

        logging.info("Found %d task OOVs " % (oov_task))
        logging.info("Found %d pretrain OOVs " % (oov_pretrain))
        task_embeddings = np.stack(task_embeddings)
        self.encoder.set_pretrained_embeddings(task_embeddings)
        self.vocab_expanded = True

        # Move encoder to GPU if self.cuda
        if self.cuda:
            self.encoder = self.encoder.cuda()
 Expand the model's vocabulary with pretrained word embeddings.

        Args:
            task_vocab(list): Vocabulary for each task.
        
utils_nlp/models/gensen/gensen.py