MCPcopy Create free account
hub / github.com/ChenHsing/SVFormer / parse_args

Function parse_args

timesformer/utils/parser.py:12–63  ·  view source on GitHub ↗

Parse the following arguments for a default parser for PySlowFast users. Args: shard_id (int): shard id for the current machine. Starts from 0 to num_shards - 1. If single machine is used, then set shard id to 0. num_shards (int): number of shards using by the jo

()

Source from the content-addressed store, hash-verified

10
11
12def parse_args():
13 """
14 Parse the following arguments for a default parser for PySlowFast users.
15 Args:
16 shard_id (int): shard id for the current machine. Starts from 0 to
17 num_shards - 1. If single machine is used, then set shard id to 0.
18 num_shards (int): number of shards using by the job.
19 init_method (str): initialization method to launch the job with multiple
20 devices. Options includes TCP or shared file-system for
21 initialization. details can be find in
22 https://pytorch.org/docs/stable/distributed.html#tcp-initialization
23 cfg (str): path to the config file.
24 opts (argument): provide addtional options from the command line, it
25 overwrites the config loaded from file.
26 """
27 parser = argparse.ArgumentParser(
28 description="Provide SlowFast video training and testing pipeline."
29 )
30 parser.add_argument(
31 "--shard_id",
32 help="The shard id of current node, Starts from 0 to num_shards - 1",
33 default=0,
34 type=int,
35 )
36 parser.add_argument(
37 "--num_shards",
38 help="Number of shards using by the job",
39 default=1,
40 type=int,
41 )
42 parser.add_argument(
43 "--init_method",
44 help="Initialization method, includes TCP or shared file-system",
45 default="tcp://localhost:9999",
46 type=str,
47 )
48 parser.add_argument(
49 "--cfg",
50 dest="cfg_file",
51 help="Path to the config file",
52 default="configs/Kinetics/SLOWFAST_4x16_R50.yaml",
53 type=str,
54 )
55 parser.add_argument(
56 "opts",
57 help="See slowfast/config/defaults.py for all options",
58 default=None,
59 nargs=argparse.REMAINDER,
60 )
61 if len(sys.argv) == 1:
62 parser.print_help()
63 return parser.parse_args()
64
65
66def load_config(args):

Callers 3

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected