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
ModelZoo
ResNet50_tensorflow
Commits
601b3024
Commit
601b3024
authored
Apr 05, 2021
by
A. Unique TensorFlower
Browse files
Internal change
PiperOrigin-RevId: 366879385
parent
f95cb722
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
official/core/config_definitions.py
official/core/config_definitions.py
+2
-0
official/core/train_lib.py
official/core/train_lib.py
+2
-1
official/core/train_lib_test.py
official/core/train_lib_test.py
+6
-0
No files found.
official/core/config_definitions.py
View file @
601b3024
...
@@ -201,6 +201,7 @@ class TrainerConfig(base_config.Config):
...
@@ -201,6 +201,7 @@ class TrainerConfig(base_config.Config):
best_checkpoint_metric_comp: for exporting the best checkpoint, how the
best_checkpoint_metric_comp: for exporting the best checkpoint, how the
trainer should compare the evaluation metrics. This can be either `higher`
trainer should compare the evaluation metrics. This can be either `higher`
(higher the better) or `lower` (lower the better).
(higher the better) or `lower` (lower the better).
validation_summary_subdir: A 'str', sub directory for saving eval summary.
"""
"""
optimizer_config
:
OptimizationConfig
=
OptimizationConfig
()
optimizer_config
:
OptimizationConfig
=
OptimizationConfig
()
# Orbit settings.
# Orbit settings.
...
@@ -232,6 +233,7 @@ class TrainerConfig(base_config.Config):
...
@@ -232,6 +233,7 @@ class TrainerConfig(base_config.Config):
# the condition and fail the job if the condition happens; max trials > 0,
# the condition and fail the job if the condition happens; max trials > 0,
# we will retore the model states.
# we will retore the model states.
recovery_max_trials
:
int
=
0
recovery_max_trials
:
int
=
0
validation_summary_subdir
:
str
=
"validation"
@
dataclasses
.
dataclass
@
dataclasses
.
dataclass
...
...
official/core/train_lib.py
View file @
601b3024
...
@@ -88,7 +88,8 @@ def run_experiment(distribution_strategy: tf.distribute.Strategy,
...
@@ -88,7 +88,8 @@ def run_experiment(distribution_strategy: tf.distribute.Strategy,
steps_per_loop
=
params
.
trainer
.
steps_per_loop
,
steps_per_loop
=
params
.
trainer
.
steps_per_loop
,
checkpoint_manager
=
checkpoint_manager
,
checkpoint_manager
=
checkpoint_manager
,
summary_dir
=
os
.
path
.
join
(
model_dir
,
'train'
)
if
(
save_summary
)
else
None
,
summary_dir
=
os
.
path
.
join
(
model_dir
,
'train'
)
if
(
save_summary
)
else
None
,
eval_summary_dir
=
os
.
path
.
join
(
model_dir
,
'validation'
)
if
eval_summary_dir
=
os
.
path
.
join
(
model_dir
,
params
.
trainer
.
validation_summary_subdir
)
if
(
save_summary
)
else
None
,
(
save_summary
)
else
None
,
summary_interval
=
params
.
trainer
.
summary_interval
if
summary_interval
=
params
.
trainer
.
summary_interval
if
(
save_summary
)
else
None
)
(
save_summary
)
else
None
)
...
...
official/core/train_lib_test.py
View file @
601b3024
...
@@ -49,6 +49,7 @@ class TrainTest(tf.test.TestCase, parameterized.TestCase):
...
@@ -49,6 +49,7 @@ class TrainTest(tf.test.TestCase, parameterized.TestCase):
'validation_steps'
:
5
,
'validation_steps'
:
5
,
'validation_interval'
:
10
,
'validation_interval'
:
10
,
'continuous_eval_timeout'
:
1
,
'continuous_eval_timeout'
:
1
,
'validation_summary_subdir'
:
'validation'
,
'optimizer_config'
:
{
'optimizer_config'
:
{
'optimizer'
:
{
'optimizer'
:
{
'type'
:
'sgd'
,
'type'
:
'sgd'
,
...
@@ -90,6 +91,11 @@ class TrainTest(tf.test.TestCase, parameterized.TestCase):
...
@@ -90,6 +91,11 @@ class TrainTest(tf.test.TestCase, parameterized.TestCase):
model_dir
=
model_dir
,
model_dir
=
model_dir
,
run_post_eval
=
run_post_eval
)
run_post_eval
=
run_post_eval
)
if
'eval'
in
flag_mode
:
self
.
assertTrue
(
tf
.
io
.
gfile
.
exists
(
os
.
path
.
join
(
model_dir
,
params
.
trainer
.
validation_summary_subdir
)))
if
run_post_eval
:
if
run_post_eval
:
self
.
assertNotEmpty
(
logs
)
self
.
assertNotEmpty
(
logs
)
else
:
else
:
...
...
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