def run_train(self): config_list = self.build_tmp_config_file() for i, config in enumerate(config_list): dump_yaml(self.logger, config, path=f"tmp/_tmp_config_{i:4d}.yaml") tag = self.ablation_config['ablation']['tag'] + f"_try{i:04d}" cmd = f"CUDA_VISIBLE_DEVICES={self.gpus} python {self.script_file} --tag {tag} --config {f'tmp/_tmp_config_{i:4d}.yaml'}" self._run_and_record_process_status(i, cmd, config, tag)
def run_test(self): config_list = self.build_tmp_config_file() for i, config in enumerate(config_list): dump_yaml(self.logger, config, path="tmp/_tmp_config.yaml") tag = self.ablation_config['base']['tag'] + "/" + self.ablation_config['ablation']['tag'] + f"_try{i}" cmd = f"CUDA_VISIBLE_DEVICES={self.gpus} python {self.script_file} --tag {tag} --config {'tmp/_tmp_config.yaml'} --test" self.logger.info(f"Run cmd: {cmd}") ret_value = subprocess.call(cmd, shell=True) self.logger.info(f"ret value: {ret_value}")
def run_with_config(self): config_list = self.build_tmp_config_file() for i, config in enumerate(config_list): dump_yaml(self.logger, config, path="tmp/_tmp_config.yaml") cmd = self.running_cmd + f" --config {'tmp/_tmp_config.yaml'}" runs_dir = self._search_runs_dir(config) self.logger.info(f"Run cmd: {cmd}") ret_value = subprocess.call(cmd, shell=True) self.logger.info(f"ret value: {ret_value}")
def run_with_config(self): assert len( self.config_list) > 0, f"Config File Error: Got NO opts to parse" for i in range(self.config_len): config = self.config_list[i] params = self.params_list[i] dump_yaml(self.logger, config, path=tfilename(self.runs_dir, "tmp/_tmp_config.yaml")) cmd = self.running_cmd + f" --config {tfilename(self.runs_dir, 'tmp/_tmp_config.yaml')}" if self.auto_tag: tag = self.abla_tags[i] cmd += f" --tag {tag}" else: tag = None self.logger.info(f"Run cmd: {cmd}") p = subprocess.Popen(cmd, shell=True) p.wait() if self.gather_record: self.integrate_records(config, {**params}, tag)