Skip to content

Commit

Permalink
[Fix] Fix local-rank argument in test(#2469)
Browse files Browse the repository at this point in the history
* fix local rank in test 2

* fix test.py
  • Loading branch information
sunjiahao1999 authored Apr 26, 2023
1 parent 37055ca commit 74bbc07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def parse_args():
help='job launcher')
parser.add_argument(
'--tta', action='store_true', help='Test time augmentation')
parser.add_argument('--local_rank', type=int, default=0)
# When using PyTorch version >= 2.0.0, the `torch.distributed.launch`
# will pass the `--local-rank` parameter to `tools/test.py` instead
# of `--local_rank`.
parser.add_argument('--local_rank', '--local-rank', type=int, default=0)
args = parser.parse_args()
if 'LOCAL_RANK' not in os.environ:
os.environ['LOCAL_RANK'] = str(args.local_rank)
Expand Down

0 comments on commit 74bbc07

Please sign in to comment.