import bbrsa, logging from bbrsa.grid_search import * from bbrsa.utils import init_logger default_opts = bbrsa.DEFAULT_OPTS logging.basicConfig(level=logging.WARNING) logger = init_logger(print_level=logging.INFO) part1_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt1_shuf_step_73945.pt' part2_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt2_shuf_step_73945.pt' src_path = 'data/valid.head50.art.txt' tgt_path = 'data/valid.head50.tgt.txt' db_path = 'tables/debug.db' verbose_output = '/home/hansonlu/links/data/debug/debug' test_opts = default_opts.clone() test_opts.set_as_default({ 'mode': 'incr_s1', 'pragmatics': 'basic', 'beam_size': 5, 'batch_size': 5, 'prag_alpha': 1., 'mode': 'incr_s1', 'gpu': True, 'shard_size': 2000, 'distractor': 'bert', 'bert_distr_no_subword_repl': True, 'bert_distr_d_factor': 5, 'bert_distr_exclusion_set': 3, 'bert_distr_repl_search_top': 5, 'bert_distr_repl_search_bottom': 10
opts = bbrsa.DEFAULT_OPTS part1_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt1_shuf_step_73945.pt' src_path = '/home/hansonlu/CSLI/bbrsa/data/valid.head20.art.txt' tgt_path = '/home/hansonlu/CSLI/bbrsa/data/valid.head20.tgt.txt' # part2_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt2_nocov_step_59156.pt' stats_dump = 'results/profiler_l1_valid.prof' parser = argparse.ArgumentParser() parser.add_argument('-m', '--model', default=part1_model_path) parser.add_argument('-o', '--out', default=stats_dump) parser.add_argument('-p', '--profiler', action="store_true") args = parser.parse_args() logger = init_logger(no_format=True, print_level=logging.DEBUG) # eval_s0 = ONMTSummarizer(opts, part1_model_path) # evaluator = Evaluator(eval_s0, logger=logger) opts.gpu = False opts.batch_size = 1 opts.beam_size = 20 opts.n_best = 1 opts.prag_alpha = 1.5 opts.bert_distr_repl_search_top = 5 opts.bert_distr_repl_search_bottom = 10 opts.bert_distr_no_subword_repl = True opts.bert_distr_exclusion_set = 3 summ_s0 = ONMTSummarizer(opts, args.model, logger=logger) pragmatics = MemoizedListener(opts) # ok
import bbrsa, logging from bbrsa.grid_search import * from bbrsa.utils import init_logger logger = init_logger(print_level=logging.DEBUG) default_opts = bbrsa.DEFAULT_OPTS part1_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt1_nocov_step_59156_valacc48.57_ppl15.51.pt' part2_model_path = '/home/hansonlu/links/data/giga-models/giga_halfsplit_pt2_nocov_step_59156.pt' src_path = 'data/giga_tail50valid_art.txt' tgt_path = 'data/giga_tail50valid_tgt.txt' db_path = 'tables/50testres.db' test_opts = default_opts.clone() # test_opts.set_as_default({'beam_size': 5, # 'batch_size': 10, # 'prag_alpha': 1., # 'distractor': 'bert', # 'gpu': True, # 'mode': 'incr_s1'}) # the following is from run_grid_search test_opts.set_as_default({'beam_size': 10, 'batch_size': 10, 'prag_alpha': 1., 'mode': 'incr_s1', 'gpu': True, 'shard_size': 2000, 'distractor': 'bert', 'bert_distr_d_factor': 2})