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

Function load_config

slowfast/utils/parser.py:67–94  ·  view source on GitHub ↗

Given the arguemnts, load and initialize the configs. Args: args (argument): arguments includes `shard_id`, `num_shards`, `init_method`, `cfg_file`, and `opts`.

(args)

Source from the content-addressed store, hash-verified

65
66
67def load_config(args):
68 """
69 Given the arguemnts, load and initialize the configs.
70 Args:
71 args (argument): arguments includes `shard_id`, `num_shards`,
72 `init_method`, `cfg_file`, and `opts`.
73 """
74 # Setup cfg.
75 cfg = get_cfg()
76 # Load config from cfg.
77 if args.cfg_file is not None:
78 cfg.merge_from_file(args.cfg_file)
79 # Load config from command line, overwrite config from opts.
80 if args.opts is not None:
81 cfg.merge_from_list(args.opts)
82
83 # Inherit parameters from args.
84 if hasattr(args, "num_shards") and hasattr(args, "shard_id"):
85 cfg.NUM_SHARDS = args.num_shards
86 cfg.SHARD_ID = args.shard_id
87 if hasattr(args, "rng_seed"):
88 cfg.RNG_SEED = args.rng_seed
89 if hasattr(args, "output_dir"):
90 cfg.OUTPUT_DIR = args.output_dir
91
92 # Create the checkpoint dir.
93 cu.make_checkpoint_dir(cfg.OUTPUT_DIR)
94 return cfg

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls 1

get_cfgFunction · 0.90

Tested by

no test coverage detected