예제 #1
0
 def train_nfold(self, x_train, y_train, vocab_init=None):
     self.models = train_folds(x_train, y_train, self.model_config,
                               self.training_config, self.embeddings)
     if self.embeddings.use_ELMo:
         self.embeddings.clean_ELMo_cache()
     if self.embeddings.use_BERT:
         self.embeddings.clean_BERT_cache()
예제 #2
0
    def train_nfold(self, x_train, y_train, vocab_init=None, callbacks=None):
        # bert models
        if self.model_config.model_type.find("bert") != -1:     
            self.model = getModel(self.model_config, self.training_config)
            self.model.processor = BERT_classifier_processor(labels=self.model_config.list_classes, x_train=x_train, y_train=y_train)
            self.model.train()
            return

        self.models = train_folds(x_train, y_train, self.model_config, self.training_config, self.embeddings, callbacks=callbacks)
        if self.embeddings.use_ELMo:
            self.embeddings.clean_ELMo_cache()
        if self.embeddings.use_BERT:
            self.embeddings.clean_BERT_cache()
예제 #3
0
 def train_nfold(self, x_train, y_train, vocab_init=None, callbacks=None):
     self.models = train_folds(x_train, y_train, self.model_config, self.training_config, self.embeddings, callbacks=callbacks)