Skip to content

Commit

Permalink
remove LOCAL_RANK check
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasfshr committed Nov 5, 2021
1 parent 51a6910 commit bca6043
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions mmcv/runner/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,7 @@ def load_from_http(filename, map_location=None, model_dir=None):
dict or OrderedDict: The loaded checkpoint.
"""
rank, world_size = get_dist_info()
rank = int(os.environ.get('LOCAL_RANK', rank))
# If LOCAL_RANK is set before ddp is initialized, the if condition
# 'if dist.is_available() and dist.is_initialized()' in get_dist_info will
# fail and lead to world_size = 1 while rank > 0 for non-master processes.
# Thus, check if either rank == 0 or world_size == 1 here.
if rank == 0 or world_size == 1:
if rank == 0:
checkpoint = model_zoo.load_url(
filename, model_dir=model_dir, map_location=map_location)
if world_size > 1:
Expand Down

0 comments on commit bca6043

Please sign in to comment.