else: argv = sys.argv[1:] args = parser.parse_args(argv) args = complete_default_train_parser(args) logger.info('-' * 100) logger.info('Input Argument Information') logger.info('-' * 100) args_dict = vars(args) for a in args_dict: logger.info('%-28s %s' % (a, args_dict[a])) ######################################################################### # Read Data ########################################################################## helper = DataHelper(gz=True, config=args) # Set datasets train_dataloader = helper.train_loader dev_example_dict = helper.dev_example_dict dev_feature_dict = helper.dev_feature_dict dev_dataloader = helper.dev_loader ######################################################################### # Initialize Model ########################################################################## cached_config_file = join(args.exp_name, 'cached_config.bin') if os.path.exists(cached_config_file): cached_config = torch.load(cached_config_file) encoder_path = join(args.exp_name, cached_config['encoder']) model_path = join(args.exp_name, cached_config['model'])
def prepare_data(self): helper = DataHelper(gz=True, config=self.args) self.train_data = helper.train_loader self.dev_example_dict = helper.dev_example_dict self.dev_feature_dict = helper.dev_feature_dict self.dev_data = helper.dev_loader