Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
3783f3f4
Unverified
Commit
3783f3f4
authored
Oct 25, 2021
by
Nicolas Hug
Committed by
GitHub
Oct 25, 2021
Browse files
Fix reduce_across_processes inconsistent return type (#4733)
parent
9ae833af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
references/classification/utils.py
references/classification/utils.py
+3
-1
No files found.
references/classification/utils.py
View file @
3783f3f4
...
@@ -403,7 +403,9 @@ def store_model_weights(model, checkpoint_path, checkpoint_key="model", strict=T
...
@@ -403,7 +403,9 @@ def store_model_weights(model, checkpoint_path, checkpoint_key="model", strict=T
def
reduce_across_processes
(
val
):
def
reduce_across_processes
(
val
):
if
not
is_dist_avail_and_initialized
():
if
not
is_dist_avail_and_initialized
():
return
val
# nothing to sync, but we still convert to tensor for consistency with the distributed case.
return
torch
.
tensor
(
val
)
t
=
torch
.
tensor
(
val
,
device
=
"cuda"
)
t
=
torch
.
tensor
(
val
,
device
=
"cuda"
)
dist
.
barrier
()
dist
.
barrier
()
dist
.
all_reduce
(
t
)
dist
.
all_reduce
(
t
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment