-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.py
45 lines (35 loc) · 1.07 KB
/
generate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import argparse
import json
import os
from pgr import PathwayGenerator
def main(path, pilot, service):
pgr = PathwayGenerator(file_path=path, pilot=pilot, service=service, use_cuda=True, cuda_device=4)
pathway = pgr.do_generate()
pathway_dict, pathway_path = pgr.export_generation_to_doccano(pathway={'Step1': pathway})
print('Generation process ended. You can find the jsonl at the following path: {}'.format(pathway_path))
if __name__ == '__main__':
"""Input example:
$python generate.py --file \
filename.json
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'-f',
'--file',
help='List of files to be converted before transner',
required=True
)
parser.add_argument(
'-p',
'--pilot',
help='Specify pilot.',
required=True
)
parser.add_argument(
'-s',
'--service',
help='Specify service.',
required=True
)
args = parser.parse_args()
main(path=args.file, pilot=args.pilot, service=args.service)