-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (36 loc) · 1.23 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
45
46
from openood.pipelines import get_pipeline
from openood.utils import launch, seed_everything, setup_config, get_config_default
import torch
def main(config):
"""Main entrance. Config is all you need to provide to run the code. Config
should be provided in the format of YAML and can be modified with command
line.
Example:
python main.py \
--config configs/datasets/mnist_datasets.yml \
configs/train/mnist_baseline.yml \
--dataset.image_size 32 \
--network res18
Note:
A config file is the minimum requirement.
You don't need to add "--config_key new_value"
if you don't have anything to modify.
"""
if get_config_default(config, "seed", None) is not None:
seed_everything(config.seed)
pipeline = get_pipeline(config)
pipeline.run()
if __name__ == '__main__':
config = setup_config()
# generate output directory and save the full config file
# setup_logger(config)
# pipeline = get_pipeline(config)
# pipeline.run()
launch(
main,
config.num_gpus,
num_machines=config.num_machines,
machine_rank=config.machine_rank,
dist_url='auto',
args=(config, ),
)