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