Пример #1
0
  def __init__(self, config_path, name):
    # Define constants and paths
    self.TASK = ve.CHUNK
    self.MODE = ve.FINE
    self.name = name
    (self.train_data_path, self.checkpoint_path,
     self.embedding_path) = ve.make_paths(self.TASK, self.MODE, self.name)
    
    # Get embeddings
    self.embeddings = pickle.load(open(self.embedding_path, 'r'))
    self.ds = IndexWindowCapsDataset(self.train_data_path, self.embeddings,
                                     has_validation=False, is_testing=ve.IS_TESTING)

    # Define model 
    self.hp = ve.read_hp(config_path)
    self.hp.stop_epochs = ve.STOP_EPOCHS
    self.model = self.build_model()
Пример #2
0
    def __init__(self, config_path, name):
        # Define constants and paths
        self.TASK = ve.NLI
        self.MODE = ve.FIXED
        self.name = name
        (self.train_data_path, self.checkpoint_path,
         self.embedding_path) = ve.make_paths(self.TASK, self.MODE, self.name)

        # Get embeddings
        self.embeddings = pickle.load(open(self.embedding_path, 'r'))
        self.ds = EmbeddingPairDataset(self.train_data_path,
                                       self.embeddings,
                                       ve.NLI_MAX_LEN,
                                       has_validation=True,
                                       is_testing=ve.IS_TESTING)

        # Define model
        self.hp = ve.read_hp(config_path)
        self.hp.stop_epochs = ve.STOP_EPOCHS
        self.model = self.build_model()