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
apex
Commits
80479eed
Unverified
Commit
80479eed
authored
Jun 26, 2018
by
mcarilli
Committed by
GitHub
Jun 26, 2018
Browse files
More stringent check for parameter changes to trigger refresh of distributed (#20)
* More stringent check for distributed refresh
parent
a7319cee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
apex/fp16_utils/fp16_optimizer.py
apex/fp16_utils/fp16_optimizer.py
+2
-3
apex/parallel/distributed.py
apex/parallel/distributed.py
+5
-4
No files found.
apex/fp16_utils/fp16_optimizer.py
View file @
80479eed
...
@@ -428,7 +428,6 @@ class FP16_Optimizer(object):
...
@@ -428,7 +428,6 @@ class FP16_Optimizer(object):
while
(
self
.
overflow
):
while
(
self
.
overflow
):
scale
=
self
.
loss_scaler
.
loss_scale
scale
=
self
.
loss_scaler
.
loss_scale
self
.
_update_scale
(
self
.
overflow
)
self
.
_update_scale
(
self
.
overflow
)
if
self
.
overflow
:
print
(
"OVERFLOW within closure! Skipping step. Attempted loss scale: {}, "
print
(
"OVERFLOW within closure! Skipping step. Attempted loss scale: {}, "
"reducing to {}"
.
format
(
scale
,
self
.
loss_scale
))
"reducing to {}"
.
format
(
scale
,
self
.
loss_scale
))
temp_loss
=
closure
()
temp_loss
=
closure
()
...
...
apex/parallel/distributed.py
View file @
80479eed
...
@@ -198,12 +198,13 @@ class DistributedDataParallel(Module):
...
@@ -198,12 +198,13 @@ class DistributedDataParallel(Module):
#Force needs_refresh to True if there are shared params
#Force needs_refresh to True if there are shared params
#this will force it to always, only call flush_buckets which is safe
#this will force it to always, only call flush_buckets which is safe
#for shared parameters in the model.
#for shared parameters in the model.
if
not
self
.
param_refs
or
self
.
shared_param
:
#Parentheses are not necessary for correct order of operations, but make the intent clearer.
if
(
not
self
.
param_refs
)
or
self
.
shared_param
:
self
.
needs_refresh
=
True
self
.
needs_refresh
=
True
else
:
else
:
self
.
needs_refresh
=
any
(
self
.
needs_refresh
=
(
[
param1
is
not
param2
for
param1
,
param2
in
zip
(
param_list
,
self
.
param_refs
)
]
(
len
(
param_list
)
!=
len
(
self
.
param_refs
)
)
or
any
(
)
[
param1
is
not
param2
for
param1
,
param2
in
zip
(
param_list
,
self
.
param_refs
)])
)
if
self
.
needs_refresh
:
if
self
.
needs_refresh
:
self
.
record
=
[]
self
.
record
=
[]
...
...
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