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
12d2c737
Unverified
Commit
12d2c737
authored
May 19, 2019
by
Francisco Massa
Committed by
GitHub
May 19, 2019
Browse files
Fixes for PyTorch 1.1 (#919)
parent
86db394e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
references/classification/train.py
references/classification/train.py
+2
-2
references/segmentation/train.py
references/segmentation/train.py
+1
-1
No files found.
references/classification/train.py
View file @
12d2c737
...
@@ -147,7 +147,7 @@ def main(args):
...
@@ -147,7 +147,7 @@ def main(args):
model
=
torchvision
.
models
.
__dict__
[
args
.
model
]()
model
=
torchvision
.
models
.
__dict__
[
args
.
model
]()
model
.
to
(
device
)
model
.
to
(
device
)
if
args
.
distributed
and
args
.
sync_bn
:
if
args
.
distributed
and
args
.
sync_bn
:
model
=
torch
.
nn
.
utils
.
convert_sync_batchnorm
(
model
)
model
=
torch
.
nn
.
SyncBatchNorm
.
convert_sync_batchnorm
(
model
)
model_without_ddp
=
model
model_without_ddp
=
model
if
args
.
distributed
:
if
args
.
distributed
:
...
@@ -177,8 +177,8 @@ def main(args):
...
@@ -177,8 +177,8 @@ def main(args):
for
epoch
in
range
(
args
.
start_epoch
,
args
.
epochs
):
for
epoch
in
range
(
args
.
start_epoch
,
args
.
epochs
):
if
args
.
distributed
:
if
args
.
distributed
:
train_sampler
.
set_epoch
(
epoch
)
train_sampler
.
set_epoch
(
epoch
)
lr_scheduler
.
step
()
train_one_epoch
(
model
,
criterion
,
optimizer
,
data_loader
,
device
,
epoch
,
args
.
print_freq
)
train_one_epoch
(
model
,
criterion
,
optimizer
,
data_loader
,
device
,
epoch
,
args
.
print_freq
)
lr_scheduler
.
step
()
evaluate
(
model
,
criterion
,
data_loader_test
,
device
=
device
)
evaluate
(
model
,
criterion
,
data_loader_test
,
device
=
device
)
if
args
.
output_dir
:
if
args
.
output_dir
:
checkpoint
=
{
checkpoint
=
{
...
...
references/segmentation/train.py
View file @
12d2c737
...
@@ -124,7 +124,7 @@ def main(args):
...
@@ -124,7 +124,7 @@ def main(args):
model
=
torchvision
.
models
.
segmentation
.
__dict__
[
args
.
model
](
num_classes
=
num_classes
,
aux_loss
=
args
.
aux_loss
)
model
=
torchvision
.
models
.
segmentation
.
__dict__
[
args
.
model
](
num_classes
=
num_classes
,
aux_loss
=
args
.
aux_loss
)
model
.
to
(
device
)
model
.
to
(
device
)
if
args
.
distributed
:
if
args
.
distributed
:
model
=
torch
.
nn
.
utils
.
convert_sync_batchnorm
(
model
)
model
=
torch
.
nn
.
SyncBatchNorm
.
convert_sync_batchnorm
(
model
)
if
args
.
resume
:
if
args
.
resume
:
checkpoint
=
torch
.
load
(
args
.
resume
,
map_location
=
'cpu'
)
checkpoint
=
torch
.
load
(
args
.
resume
,
map_location
=
'cpu'
)
...
...
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