def setup_loss_file(self, args): save_folder = train_utils.get_save_folder(args.run_config) loss_file = "loss_results" loss_file += train_utils.get_file_suffix(args) loss_file += '.jsonl' loss_file = os.path.join(save_folder, loss_file) open(loss_file, 'w').close() return loss_file
def setup_dev_files(self, args): dev_files = {} save_folder = train_utils.get_save_folder(args.run_config) dev_file_tag = args.data_config.dev_dataset.file.split('.jsonl')[0] dev_file = dev_file_tag + "_dev_results" dev_file += train_utils.get_file_suffix(args) dev_file += '.jsonl' dev_file = os.path.join(save_folder, dev_file) # Clear old file open(dev_file, 'w').close() dev_files[args.data_config.dev_dataset.file] = dev_file return dev_files
def setup_test_files(self, args): test_files = {} save_folder = train_utils.get_save_folder(args.run_config) test_file_tag = args.data_config.test_dataset.file.split('.jsonl')[0] test_file = test_file_tag + "_test_results" test_file += train_utils.get_file_suffix(args) test_file += '.jsonl' test_file = os.path.join(save_folder, test_file) # Clear old file open(test_file, 'w').close() test_files[args.data_config.test_dataset.file] = test_file return test_files
def get_log_name(args, mode): log_name = os.path.join(train_utils.get_save_folder(args.run_config), f"log_{mode}") log_name += train_utils.get_file_suffix(args) log_name += f'_gpu{args.run_config.gpu}' return log_name