Example #1
0
def main(args):
    print_config(args)
    set_random_seed(args['random_seed'])
    model = ModelHandler(args)
    model.train()
    model.test()
Example #2
0
                    help="Epsilon for Adam optimizer.")
parser.add_argument('--gpu_list', type = str, default = '2'
, help = 'gpu_list,1,2')

parser.add_argument('--save_state_dir', type = str, default = 'output') #output for data and model
parser.add_argument('--pretrained_dir', type = str, default = 'output')#input for model 
parser.add_argument('--preprocessed_data_dir', type = str, default = '108647')  #input for data 
parser.add_argument('--mode', type = str, default = 'preprocess', help = ' preprocess or train or test or debug')
parser.add_argument('--data_set_range', type = str, default = 'DEV_DATA'
, help = ' TRAIN_DATA or DEV_DATA ')


args = vars(parser.parse_args())

if args['model_name'] == 'SpanBERT':
    download_model()
    args['model_path'] = 'tmp_' 

 

os.environ["CUDA_VISIBLE_DEVICES"] = args['gpu_list']

 
print("args: ",args)

handler = ModelHandler(args)
if args['mode']=='train' or args['mode']=='debug':
    handler.train()
elif args['mode']=='test':
    handler.test()