def output(self): if os.path.exists(c.QANTA_EXPO_DATASET_PATH): folds = [c.GUESSER_DEV_FOLD, c.GUESSER_TEST_FOLD, c.EXPO_FOLD] else: folds = [c.GUESSER_DEV_FOLD, c.GUESSER_TEST_FOLD] targets = [ LocalTarget( AbstractGuesser.reporting_path( self.guesser_module, self.guesser_class, self.config_num, f"guesser_params.pickle", )) ] for f in folds: targets.append( LocalTarget( AbstractGuesser.reporting_path( self.guesser_module, self.guesser_class, self.config_num, f"guesser_report_{f}.pickle", ))) return targets
def run(self): guesser_class = get_class(self.guesser_module, self.guesser_class) reporting_directory = AbstractGuesser.reporting_path( self.guesser_module, self.guesser_class, self.config_num, "") # In the cases of huge parameter sweeps on SLURM its easy to accidentally run out of /fs/ storage. # Since we only care about the results we can get them, then delete the models. We can use the regular # GuesserReport to preserve the model guesser_directory = AbstractGuesser.output_path( self.guesser_module, self.guesser_class, self.config_num, "") param_path = AbstractGuesser.output_path( self.guesser_module, self.guesser_class, self.config_num, f"guesser_params.pickle", ) guesses_files = [] if os.path.exists(c.QANTA_EXPO_DATASET_PATH): folds = [c.GUESSER_DEV_FOLD, c.GUESSER_TEST_FOLD, c.EXPO_FOLD] else: folds = [c.GUESSER_DEV_FOLD, c.GUESSER_TEST_FOLD] for f in folds: guesses_files.extend([ f"guesses_char_{f}.pickle", f"guesses_full_{f}.pickle", f"guesses_first_{f}.pickle", ]) guesses_paths = [ AbstractGuesser.output_path(self.guesser_module, self.guesser_class, self.config_num, f) for f in guesses_files ] log.info(f'Running: "cp {param_path} {reporting_directory}"') shell(f"cp {param_path} {reporting_directory}") for g_path in guesses_paths: log.info(f'Running: "cp {g_path} {reporting_directory}"') shell(f"cp {g_path} {reporting_directory}") guesser_instance = guesser_class(self.config_num) for f in folds: guesser_instance.create_report(reporting_directory, f) log.info(f'Running: "rm -rf {guesser_directory}"') shell(f"rm -rf {guesser_directory}") for g_path in guesses_paths: shell(f"rm -f {g_path}")