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
2a8022ca
Commit
2a8022ca
authored
Nov 30, 2018
by
Michael Carilli
Browse files
Adding deterministic option to main_fp16_optimizer.py
parent
b436213e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
examples/imagenet/main_fp16_optimizer.py
examples/imagenet/main_fp16_optimizer.py
+8
-0
No files found.
examples/imagenet/main_fp16_optimizer.py
View file @
2a8022ca
...
...
@@ -68,6 +68,7 @@ parser.add_argument('--dynamic-loss-scale', action='store_true',
'--static-loss-scale.'
)
parser
.
add_argument
(
'--prof'
,
dest
=
'prof'
,
action
=
'store_true'
,
help
=
'Only run 10 iterations for profiling.'
)
parser
.
add_argument
(
'--deterministic'
,
action
=
'store_true'
)
parser
.
add_argument
(
"--local_rank"
,
default
=
0
,
type
=
int
)
parser
.
add_argument
(
'--sync_bn'
,
action
=
'store_true'
,
...
...
@@ -94,6 +95,12 @@ def fast_collate(batch):
best_prec1
=
0
args
=
parser
.
parse_args
()
if
args
.
deterministic
:
cudnn
.
benchmark
=
False
cudnn
.
deterministic
=
True
torch
.
manual_seed
(
args
.
local_rank
)
def
main
():
global
best_prec1
,
args
...
...
@@ -125,6 +132,7 @@ def main():
else
:
print
(
"=> creating model '{}'"
.
format
(
args
.
arch
))
model
=
models
.
__dict__
[
args
.
arch
]()
if
args
.
sync_bn
:
import
apex
print
(
"using apex synced BN"
)
...
...
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