default=True, help='using masked data or not') parser.add_argument('--use_glove', type=str2bool, default=True, help='Using Glove embedding or not') parser.add_argument('--use_extra_feature', type=str2bool, default=True, help='Using extra feature, e.g. ' + 'NER, POS, ') args = parser.parse_args() file_name = args.file_name is_masked = args.is_masked use_glove = args.use_glove use_extra_feature = args.use_extra_feature options_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_options.json' weight_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5' glove_file = 'data/glove.840B.300d.txt' logger = config_logger('Preprocess') preprocesser = Preprocesser(file_name, logger, is_masked=is_masked, use_glove=use_glove, use_extra_feature=use_extra_feature, options_file=options_file, weight_file=weight_file, glove_file=glove_file) preprocesser.preprocess()
hops = args.hop_num epochs = args.epochs batch_size = args.batch_size training_info_interval = args.info_interval dropout = args.dropout encoding_size = args.encoding_size pos_emb_size = args.pos_emb_size ner_emb_size = args.ner_emb_size options_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_options.json' weight_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_weights' encoding_type_map = {'lstm': 'lstm', 'linear': 'linear'} model_name = 'BAG' if evaluation_mode: logger = config_logger('evaluation/' + model_name) else: logger = config_logger('BAG') model_path = os.getcwd() + '/models/' + model_name + '/' if not os.path.exists(model_path): os.makedirs(model_path) tokenize = TweetTokenizer().tokenize logger.info('Hop number is %s', hops) logger.info('Learning rate is %s', learning_rate) logger.info('Training epoch is %s', epochs) logger.info('Batch size is %s', batch_size) logger.info('Dropout rate is %f', dropout) logger.info('Encoding size for nodes and query feature is %s', encoding_size)
parser.add_argument('--patience', type=int, default=5, help='Epoch early stopping patience') args = parser.parse_args() device = torch.device( 'cuda') if torch.cuda.is_available() else torch.device('cpu') encoding_type_map = {'lstm': 'lstm', 'linear': 'linear'} best_res = {'acc': 0.0} pred_res = [] model_name = 'BAG-pytorch' if args.evaluation_mode: logger = config_logger('evaluation-pytorch/' + model_name) else: logger = config_logger('BAG-pytorch') model_path = os.getcwd() + '/models-pytorch/' + model_name + '/' if not os.path.exists(model_path): os.makedirs(model_path) model_path = os.path.join(model_path, 'best_model.bin') for item in vars(args).items(): logger.info('%s : %s', item[0], str(item[1])) '''Check whether preprocessed files are existed''' train_file_name_prefix, fileExist = checkPreprocessFile( args.in_file, args.add_query_node) if not fileExist: logger.info('Cannot find preprocess data %s, program will shut down.',
hops = args.hop_num epochs = args.epochs batch_size = args.batch_size training_info_interval = args.info_interval dropout = args.dropout encoding_size = args.encoding_size pos_emb_size = args.pos_emb_size ner_emb_size = args.ner_emb_size options_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_options.json' weight_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_weights' encoding_type_map = {'lstm': 'lstm', 'linear': 'linear'} model_name = 'CQ-GCN' if evaluation_mode: logger = config_logger('evaluation/' + model_name) else: logger = config_logger('CQ_GCN') model_path = os.getcwd() + '/best_models/' + model_name + '/' if not os.path.exists(model_path): os.makedirs(model_path) tokenize = TweetTokenizer().tokenize logger.info('Hop number is %s', hops) logger.info('Learning rate is %s', learning_rate) logger.info('Training epoch is %s', epochs) logger.info('Batch size is %s', batch_size) logger.info('Dropout rate is %f', dropout) logger.info('Encoding size for nodes and query feature is %s', encoding_size)
hops = args.hop_num epochs = args.epochs batch_size = args.batch_size training_info_interval = args.info_interval dropout = args.dropout encoding_size = args.encoding_size pos_emb_size = args.pos_emb_size ner_emb_size = args.ner_emb_size options_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_options.json' weight_file = 'data/elmo_2x4096_512_2048cnn_2xhighway_weights' encoding_type_map = {'lstm': 'lstm', 'linear': 'linear'} model_name = 'PathBasedGCN' if evaluation_mode: logger = config_logger('evaluation/' + model_name) else: logger = config_logger('PathBasedGCN') model_path = os.getcwd() + '/models/' + model_name + '/' if not os.path.exists(model_path): os.makedirs(model_path) tokenize = TweetTokenizer().tokenize logger.info('Hop number is %s', hops) logger.info('Learning rate is %s', learning_rate) logger.info('Training epoch is %s', epochs) logger.info('Batch size is %s', batch_size) logger.info('Dropout rate is %f', dropout) logger.info('Encoding size for nodes and query feature is %s', encoding_size)