-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·42 lines (33 loc) · 917 Bytes
/
run.py
File metadata and controls
executable file
·42 lines (33 loc) · 917 Bytes
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
#!/usr/bin/env python3
from parlai.core.params import ParlaiParser
from parlai_internal.services import CustomWebsocketManager
import parlai.chat_service.utils.config as config_utils
SERVICE_NAME = 'websocket'
def setup_args():
"""
Set up args.
"""
parser = ParlaiParser(False, False)
parser.add_parlai_data_path()
parser.add_websockets_args()
parser.add_model_args()
return parser.parse_args()
def run(opt):
"""
Run MessengerManager.
"""
opt['service'] = SERVICE_NAME
manager = CustomWebsocketManager(opt)
try:
manager.start_task()
except BaseException:
raise
finally:
manager.shutdown()
if __name__ == '__main__':
opt = setup_args()
config_path = opt.get('config_path')
config = config_utils.parse_configuration_file(config_path)
opt.update(config['world_opt'])
opt['config'] = config
run(opt)