forked from sb-ai-lab/RePlay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·44 lines (34 loc) · 1.24 KB
/
main.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
"""Main module"""
import os
import logging
import warnings
import yaml
import argparse
from replay_benchmarks.utils.conf import load_config, seed_everything
from replay_benchmarks import TrainRunner, InferRunner
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s - %(levelname)s - %(message)s",
)
warnings.filterwarnings("ignore")
def main() -> None:
config_dir = "./replay_benchmarks/configs"
base_config_path = os.path.join(config_dir, "config.yaml")
# parser = argparse.ArgumentParser()
# parser.add_argument('--base_config_path', type=str, help='Path to config file')
# args = parser.parse_args()
# base_config_path = os.path.abspath(args.base_config_path)
# config_dir = os.path.dirname(base_config_path)
config = load_config(base_config_path, config_dir)
logging.info("Configuration:\n%s", yaml.dump(config))
seed_everything(config["env"]["SEED"])
logging.info(f"Fixing seed: {config['env']['SEED']}")
if config["mode"]["name"] == "train":
runner = TrainRunner(config)
elif config["mode"]["name"] == "infer":
runner = InferRunner(config)
else:
raise ValueError(f"Unsupported mode: {config['mode']}")
runner.run()
if __name__ == "__main__":
main()