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
fairscale
Commits
2d9243bf
Unverified
Commit
2d9243bf
authored
Dec 16, 2020
by
Benjamin Lefaudeux
Committed by
GitHub
Dec 16, 2020
Browse files
[fix] OSS - typo + small perf fix (#256)
* typo, sorry about that * small perf fix
parent
351f35e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
fairscale/optim/oss.py
fairscale/optim/oss.py
+6
-4
No files found.
fairscale/optim/oss.py
View file @
2d9243bf
...
...
@@ -105,9 +105,9 @@ class OSS(Optimizer):
self
.
_device
=
list
(
self
.
per_device_params
.
keys
())[
0
]
self
.
buckets
:
Dict
[
torch
.
device
,
List
[
Bucket
]]
=
{}
#
if torch.cuda.is_available() and self.world_size <= torch.cuda.device_count():
#
broadcast_buffer_size = 0
#
logging.warning("Assuming single node job, bucketing is disabled")
if
torch
.
cuda
.
is_available
()
and
self
.
world_size
<=
torch
.
cuda
.
device_count
():
broadcast_buffer_size
=
0
logging
.
warning
(
"Assuming single node job, bucketing is disabled"
)
self
.
bucket_size
=
broadcast_buffer_size
for
device
,
per_device
in
self
.
per_device_params
.
items
():
...
...
@@ -393,6 +393,8 @@ class OSS(Optimizer):
from a call to :meth:`state_dict`
"""
print
(
"loading state dict"
)
# Check whether we got a local or global dict
if
state_dict
[
"local_state_dict"
]:
self
.
load_local_state_dict
(
state_dict
)
...
...
@@ -521,7 +523,7 @@ class OSS(Optimizer):
for
param
in
params
:
# Bucket broadcast
if
self
.
should_bucket_param
[
param
]:
if
self
.
bucket_size
>
0
and
self
.
should_bucket_param
[
param
]:
assert
bucket
.
append
(
param
),
"Bucket overflow: max %s - current %s - adding %s"
%
(
bucket
.
max_size
,
bucket
.
current_offset
,
...
...
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