You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I noticed that when I run the DDP program with torch.distributed.launch, pytorch indicates that torch.distributed.launch is about to be deprecated.
dancer@server:~/dev$ python3 -m torch.distributed.launch --nproc_per_node 2 run.py
/opt/conda/lib/python3.9/site-packages/torch/distributed/launch.py:178: FutureWarning:
The module torch.distributed.launch is deprecated and will be removed in future. Use torchrun.
Note that --use_env is set by default in torchrun.
If your script expects `--local_rank` argument to be set,
please change it to read from `os.environ['LOCAL_RANK']` instead.
See https://pytorch.org/docs/stable/distributed.html#launch-utility for further instructions
warnings.warn( WARNING:torch.distributed.run:
defmain(args=None):
warnings.warn(
"The module torch.distributed.launch is deprecated\n""and will be removed in future. Use torchrun.\n""Note that --use_env is set by default in torchrun.\n""If your script expects `--local_rank` argument to be set, please\n""change it to read from `os.environ['LOCAL_RANK']` instead. See \n""https://pytorch.org/docs/stable/distributed.html#launch-utility for \n""further instructions\n",
FutureWarning,
)
args=parse_args(args)
launch(args)
But PyTorch ask user to If your training script reads local rank from a --local_rank cmd argument. Change your training script to read from the LOCAL_RANK environment variable as demonstrated by the following code snippet
However, ignite will pass local_rank parameter to func by default
Thanks for the report, yes we should update our docs about how to launch training with torchrun.
However in terms of code, I can recheck but ignite IS compatible with torchrun, take a look : #2191
IMO the change between distributed.launch and torchrun is that local rank is always defined as env var now and thus only running command has changed, but in the training script there can be no changes...
Let me know if I missed anything.
I got it, and I confirmed that it really doesn't require any code changes.🤦♂️Sorry for the confusion.
I previously thought local_rank was specified with a command line argument, but torchrun no longer has that command line argument, so we need to change the code.
But anyway, we need to update the documentation.
❓ Questions/Help/Support
Hi, I noticed that when I run the DDP program with
torch.distributed.launch
, pytorch indicates thattorch.distributed.launch
is about to be deprecated.The related code in PyTorch is here:
The migration guide is documented here
But PyTorch ask user to
If your training script reads local rank from a --local_rank cmd argument. Change your training script to read from the LOCAL_RANK environment variable as demonstrated by the following code snippet
However, ignite will pass
local_rank
parameter tofunc
by defaultignite/ignite/distributed/launcher.py
Lines 307 to 309 in e452884
I can continue to use
torch.distributed.launch
for now, but how should I change the program once PyTorch actually deprecatestorch.distributed.launch
?The text was updated successfully, but these errors were encountered: