def main(conf_dict, use_cuda=False): """Train main function""" data_generator = p_data_reader.RcDataReader( wordemb_dict_path=conf_dict['word_idx_path'], postag_dict_path=conf_dict['postag_dict_path'], label_dict_path=conf_dict['label_dict_path'], train_data_list_path=conf_dict['train_data_path'], test_data_list_path=conf_dict['test_data_path']) data_generator.load_train_data() train(conf_dict, data_generator, use_cuda=use_cuda)
def main(conf_dict, use_cuda=False): """Train main function""" if use_cuda and not fluid.core.is_compiled_with_cuda(): print >> sys.stderr, 'No GPU' return data_generator = p_data_reader.RcDataReader( wordemb_dict_path=conf_dict['word_idx_path'], postag_dict_path=conf_dict['postag_dict_path'], label_dict_path=conf_dict['label_dict_path'], train_data_list_path=conf_dict['train_data_path'], test_data_list_path=conf_dict['test_data_path']) train(conf_dict, data_generator, use_cuda=use_cuda)
def main(conf_dict, model_path, predict_data_path, predict_result_path, use_cuda=False): """预测主函数""" if use_cuda and not fluid.core.is_compiled_with_cuda(): return data_generator = p_data_reader.RcDataReader( wordemb_dict_path=conf_dict['word_idx_path'], postag_dict_path=conf_dict['postag_dict_path'], label_dict_path=conf_dict['label_dict_path'], train_data_list_path=conf_dict['train_data_path'], test_data_list_path=conf_dict['test_data_path']) predict_infer(conf_dict, data_generator, predict_data_path, \ predict_result_path, model_path)
def main(conf_dict, use_cuda=False): """Train main function""" if use_cuda and not fluid.core.is_compiled_with_cuda(): print >> sys.stderr, 'No GPU' return # 读取输入数据 data_generator = p_data_reader.RcDataReader( wordemb_dict_path=conf_dict['word_idx_path'], # dict/word_idx postag_dict_path=conf_dict['postag_dict_path'], # dict/postag_dict label_dict_path=conf_dict['label_dict_path'], # dict/label_dict train_data_list_path=conf_dict[ 'train_data_path'], # data/train_data.json test_data_list_path=conf_dict['test_data_path']) # data/dev_data.json # 进行训练 train(conf_dict, data_generator, use_cuda=use_cuda)
def main(conf_dict, model_path, predict_data_path, predict_result_path, use_cuda=False): """Predict main function""" data_generator = p_data_reader.RcDataReader( wordemb_dict_path=conf_dict['word_idx_path'], postag_dict_path=conf_dict['postag_dict_path'], label_dict_path=conf_dict['label_dict_path'], train_data_list_path=conf_dict['train_data_path'], test_data_list_path=conf_dict['test_data_path']) data_generator.load_test_data() predict_infer(conf_dict, data_generator, predict_data_path, \ predict_result_path, model_path)