-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand_line.py
69 lines (59 loc) · 1.53 KB
/
command_line.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 19 15:52:03 2023
@author: Enrique Casterá
"""
import argparse
import text_models as tm
def read_command_line():
parser = argparse.ArgumentParser()
valid_devices = list(tm.DeviceClass)
valid_devices = [str(x).split('.')[1] for x in valid_devices]
valid_models = tm.get_available_models()
parser.add_argument(
"--model",
type=str,
choices=valid_models,
help="model to use",
)
parser.add_argument(
"--device",
type=str,
choices=valid_devices,
help="device to use",
#default="AUTO"
)
parser.add_argument(
"--prompt",
type=str,
nargs="?",
#default="light is always",
help="initial prompt to generate text"
)
parser.add_argument(
"--max_length",
type=int,
help="max length of the generation",
)
parser.add_argument(
"--testing",
action='store_true',
help="testing mode"
)
parser.add_argument(
"--test_list_from_file",
type=str,
help="text file containing prompts for testing",
)
parser.add_argument(
"--test_models",
type=str,
nargs="?",
help="list of text models for testing",
)
opt = parser.parse_args()
return opt
if __name__ == "__main__":
opt = read_command_line()
print(opt)