Ejemplo n.º 1
0
def main(**kwargs):
    if TEST_FLAG:
        kwargs = set_local_Ontonotes_param()
    else:
        print('load parameters from .sh')

    args._parse(kwargs)
    train_CWS_POS(args)

    fn = os.path.join(args.output_dir, args.method + '_l' + str(args.num_hidden_layers) + '_rs.json')

    TS_WRITER.export_scalars_to_json(fn)
    TS_WRITER.close()
Ejemplo n.º 2
0
def main(**kwargs):
    if TEST_FLAG:
        kwargs = set_server_eval_4CWS_param()
    else:
        print('load parameters from .sh')

    args._parse(kwargs)
    train_4CWS(args)

    if args.method == 'last_layer':
        fn = os.path.join(
            args.output_dir,
            args.fclassifier + '_l' + str(args.num_hidden_layers) + '_rs.json')
    else:
        fn = os.path.join(args.output_dir,
                          args.fclassifier + '_' + args.method + '_rs.json')

    TS_WRITER.export_scalars_to_json(fn)
    TS_WRITER.close()
Ejemplo n.º 3
0
    print('Processing time: ' + str(time.time() - t0))


LOCAL_FLAG = False
LOCAL_FLAG = True

TEST_FLAG = False
#TEST_FLAG = True

if __name__ == '__main__':
    if LOCAL_FLAG:
        kwargs = set_local_eval_param()
    else:
        kwargs = set_server_eval_param()

    args._parse(kwargs)
    model = preload(args)

    if TEST_FLAG:
        test_badcase(model)

        test_cases0(model)
        test_cases(model)
        test_case_meitu(model)
    else:
        #test_from_file(model, './Test/except.txt', './Test/except_rs.txt')
        #test_from_file(model, './Test/fenci.txt', './Test/fenci_rs.txt')
        infile = '/Users/haiqinyang/Downloads/datasets/ontonotes-release-5.0/ontonote_data/test_data/fenci_multilingual.txt'
        outfile = '/Users/haiqinyang/Downloads/datasets/ontonotes-release-5.0/ontonote_data/test_data/fenci_multilingual_rs.txt'

        infile = './Test/except.txt'