-
Notifications
You must be signed in to change notification settings - Fork 179
/
Copy pathrunner.py
44 lines (30 loc) · 1.31 KB
/
runner.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
import argparse
import importlib
from cradle.config import Config
from cradle.gameio import GameManager
from cradle.log import Logger
config = Config()
logger = Logger()
def main(args):
# Choose shared or specific runner
if config.env_shared_runner is not None and len(config.env_shared_runner) > 0:
runner_key = config.env_shared_runner.lower()
else:
runner_key = config.env_short_name.lower()
# Load the runner module
runner_module = importlib.import_module(f'cradle.runner.{runner_key}_runner')
entry = getattr(runner_module, 'entry')
# Run the entry
entry(args)
def get_args_parser():
parser = argparse.ArgumentParser("Cradle Agent Runner")
parser.add_argument("--llmProviderConfig", type=str, default="./conf/openai_config.json", help="The path to the LLM provider config file")
parser.add_argument("--embedProviderConfig", type=str, default="./conf/openai_config.json", help="The path to the embedding model provider config file")
parser.add_argument("--envConfig", type=str, default="./conf/env_config_outlook.json", help="The path to the environment config file")
return parser
if __name__ == '__main__':
parser = get_args_parser()
args = parser.parse_args()
config.load_env_config(args.envConfig)
config.set_fixed_seed()
main(args)