def model(self, load_type='best'): if load_type == 'last': prefix = '_latest' else: prefix = '' return joinPath(self.Base, self.Dataset, 'models', self.ModelName + f'_v.{self.Version}' + prefix)
def addRedoTrainTask(self, dataset, version, updated_configs=None, **kwargs): pm = PathManager(dataset=dataset, version=version) # 直接读取已做过的实验的config,重新做一次 pre_config = loadJson(joinPath(pm.doc(), 'train.json')) # 加载之前version的参数后,如果有需要更新的参数,则在之前参数的基础上进行更新 if updated_configs is not None: self._setFields(pre_config, updated_configs) self.addTask('train', pre_config, **kwargs)
def apiSeqLen(self): if self.Subset == 'all': raise ValueError("[PathManager] 类型为all时无api序列长度数据文件") return joinPath(self.Base, self.Dataset, 'data', self.Subset, 'seq_length.json')
def subsetIdxClassMapping(self): if self.Subset == 'all': raise ValueError("[PathManager] 类型为all时无“下标-类”映射数据文件") return joinPath(self.Base, self.Dataset, 'data', self.Subset, 'idx_mapping.json')
def wordIndex(self): return joinPath(self.Base, self.Dataset, 'data/word_map.json')
def imgData(self): if self.Subset == 'all': raise ValueError("[PathManager] 类型为all时无pe数据文件") return joinPath(self.Base, self.Dataset, 'data', self.Subset, 'img.npy')
def imgDataFolder(self): return joinPath(self.Base, self.Dataset, self.Subset, 'img', is_dir=True)
def wordEmbedding(self): return joinPath(self.Base, self.Dataset, 'data/matrix.npy')
def datasetBase(self): return joinPath(self.Base, self.Dataset, is_dir=True)
def apiDataFolder(self): return joinPath(self.Base, self.Dataset, self.Subset, 'api', is_dir=True)
def rootBase(self): return joinPath(self.Base, is_dir=True)
def subDataBase(self): return joinPath(self.Base, self.Dataset, 'data', self.Subset, is_dir=True)
def docBase(self): return joinPath(self.Base, self.Dataset, 'doc', is_dir=True)
def testStat(self): return joinPath(self.Base, self.Dataset, 'doc', str(self.Version), "test_stat.json")
def doc(self): return joinPath(self.Base, self.Dataset, 'doc', str(self.Version), is_dir=True)