in classy_vision/distributed/launch_ray.py [0:0]
def parse_args():
"""Helper function parsing the command line options.
@retval ArgumentParser
"""
parser = ArgumentParser(
description="Classy Vision distributed training launch "
"helper utility that will spawn up multiple nodes using Ray"
)
# Optional arguments for the launch helper
parser.add_argument(
"--nnodes",
type=int,
default=1,
help="The number of nodes to use for distributed training",
)
parser.add_argument(
"--nproc_per_node",
type=int,
default=1,
help="The number of processes to launch on each node, "
"for GPU training, this is recommended to be set "
"to the number of GPUs in your system so that "
"each process can be bound to a single GPU.",
)
parser.add_argument(
"--use_env",
default=False,
action="store_true",
help="Use environment variable to pass "
"'local rank'."
"If set to True, the script will not pass "
"--local_rank as argument, and will instead set LOCAL_RANK.",
)
parser.add_argument(
"-m",
"--module",
default=False,
action="store_true",
help="Changes each process to interpret the launch script "
"as a python module, executing with the same behavior as"
"'python -m'.",
)
parser.add_argument(
"--no_python",
default=False,
action="store_true",
help='Do not prepend the training script with "python" - just exec '
"it directly. Useful when the script is not a Python script.",
)
# Ray-related arguments
group = parser.add_argument_group("Ray related arguments")
group.add_argument("--ray-address", default="auto", type=str)
# positional
parser.add_argument(
"training_script",
type=str,
help="The full path to the single GPU training "
"program/script to be launched in parallel, "
"followed by all the arguments for the "
"training script",
)
# rest from the training program
parser.add_argument("training_script_args", nargs=REMAINDER)
return parser.parse_args()