MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / main

Function main

tools/run_net_multi_node.py:25–65  ·  view source on GitHub ↗

Main function to spawn the train and test process.

()

Source from the content-addressed store, hash-verified

23
24
25def main():
26 """
27 Main function to spawn the train and test process.
28 """
29 args = parse_args()
30
31 if 'SLURM_STEP_NODELIST' in os.environ:
32 args.init_method = "tcp://{}:{}".format(
33 parse_ip(os.environ['SLURM_STEP_NODELIST']), "9999")
34
35 print("Init Method: {}".format(args.init_method))
36
37 cfg = load_config(args)
38 cfg = assert_and_infer_cfg(cfg)
39
40 cfg.NUM_SHARDS = int(os.environ['SLURM_NTASKS'])
41 cfg.SHARD_ID = int(os.environ['SLURM_NODEID'])
42
43 print(f'node id > {cfg.SHARD_ID}')
44 else:
45 cfg = load_config(args)
46 cfg = assert_and_infer_cfg(cfg)
47
48 # Perform training.
49 if cfg.TRAIN.ENABLE:
50 launch_job(cfg=cfg, init_method=args.init_method, func=train)
51
52 # Perform multi-clip testing.
53 if cfg.TEST.ENABLE:
54 launch_job(cfg=cfg, init_method=args.init_method, func=test)
55
56 # Perform model visualization.
57 if cfg.TENSORBOARD.ENABLE and (
58 cfg.TENSORBOARD.MODEL_VIS.ENABLE
59 or cfg.TENSORBOARD.WRONG_PRED_VIS.ENABLE
60 ):
61 launch_job(cfg=cfg, init_method=args.init_method, func=visualize)
62
63 # Run demo.
64 # if cfg.DEMO.ENABLE:
65 # demo(cfg)
66
67
68if __name__ == "__main__":

Callers 1

Calls 5

parse_argsFunction · 0.90
load_configFunction · 0.90
assert_and_infer_cfgFunction · 0.90
launch_jobFunction · 0.90
parse_ipFunction · 0.85

Tested by

no test coverage detected