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
nni
Commits
19d6b875
Unverified
Commit
19d6b875
authored
Mar 23, 2022
by
uniartisan
Committed by
GitHub
Mar 23, 2022
Browse files
fix: model is not synced to device when not using CPU (#4652)
parent
51d261e7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
0 deletions
+1
-0
examples/nas/multi-trial/mnist/search.py
examples/nas/multi-trial/mnist/search.py
+1
-0
No files found.
examples/nas/multi-trial/mnist/search.py
View file @
19d6b875
...
@@ -107,6 +107,7 @@ def evaluate_model(model_cls):
...
@@ -107,6 +107,7 @@ def evaluate_model(model_cls):
device
=
torch
.
device
(
'cuda'
)
if
torch
.
cuda
.
is_available
()
else
torch
.
device
(
'cpu'
)
device
=
torch
.
device
(
'cuda'
)
if
torch
.
cuda
.
is_available
()
else
torch
.
device
(
'cpu'
)
model
.
to
(
device
)
for
epoch
in
range
(
3
):
for
epoch
in
range
(
3
):
# train the model for one epoch
# train the model for one epoch
train_epoch
(
model
,
device
,
train_loader
,
optimizer
,
epoch
)
train_epoch
(
model
,
device
,
train_loader
,
optimizer
,
epoch
)
...
...
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