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
7572c1f4
Commit
7572c1f4
authored
Oct 10, 2022
by
Jiayu Ye
Committed by
A. Unique TensorFlower
Oct 10, 2022
Browse files
Internal change
PiperOrigin-RevId: 480164858
parent
bae94e6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
orbit/__init__.py
orbit/__init__.py
+1
-0
orbit/controller.py
orbit/controller.py
+21
-6
No files found.
orbit/__init__.py
View file @
7572c1f4
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
"""Defines exported symbols for the `orbit` package."""
"""Defines exported symbols for the `orbit` package."""
from
orbit
import
actions
from
orbit
import
actions
# Internal import orbit.
from
orbit
import
utils
from
orbit
import
utils
from
orbit.controller
import
Action
from
orbit.controller
import
Action
...
...
orbit/controller.py
View file @
7572c1f4
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
import
pprint
import
pprint
import
time
import
time
from
typing
import
Callable
,
Iterable
,
Optional
,
Union
from
typing
import
Any
,
Callable
,
Iterable
,
Optional
,
Union
from
absl
import
logging
from
absl
import
logging
...
@@ -101,7 +101,8 @@ class Controller:
...
@@ -101,7 +101,8 @@ class Controller:
summary_dir
:
Optional
[
str
]
=
None
,
summary_dir
:
Optional
[
str
]
=
None
,
# Evaluation related
# Evaluation related
eval_summary_dir
:
Optional
[
str
]
=
None
,
eval_summary_dir
:
Optional
[
str
]
=
None
,
):
summary_manager
:
Optional
[
Any
]
=
None
,
eval_summary_manager
:
Optional
[
Any
]
=
None
):
"""Initializes a `Controller` instance.
"""Initializes a `Controller` instance.
Note that if `checkpoint_manager` is provided and there are checkpoints in
Note that if `checkpoint_manager` is provided and there are checkpoints in
...
@@ -152,6 +153,14 @@ class Controller:
...
@@ -152,6 +153,14 @@ class Controller:
eval_summary_dir: The directory to write eval summaries to. If `None`, it
eval_summary_dir: The directory to write eval summaries to. If `None`, it
will be set to `summary_dir`. If both `summary_dir` and
will be set to `summary_dir`. If both `summary_dir` and
`eval_summary_dir` are `None`, no eval summaries will be written.
`eval_summary_dir` are `None`, no eval summaries will be written.
summary_manager: Instance of the summary manager. If set, the
`summary_dir` will be ignored. Otherwise the summary manager will be
created internally for TensorBoard summaries by default from the
`summary_dir`.
eval_summary_manager: Instance of the eval summary manager. If set, the
`eval_summary_dir` will be ignored. Otherwise the eval summary manager
will be created internally for TensorBoard summaries by default from the
`eval_summary_dir`.
Raises:
Raises:
ValueError: If both `trainer` and `evaluator` are `None`.
ValueError: If both `trainer` and `evaluator` are `None`.
...
@@ -199,8 +208,11 @@ class Controller:
...
@@ -199,8 +208,11 @@ class Controller:
if
self
.
trainer
is
not
None
:
if
self
.
trainer
is
not
None
:
self
.
step_timer
=
None
self
.
step_timer
=
None
self
.
summary_interval
=
summary_interval
self
.
summary_interval
=
summary_interval
self
.
summary_manager
=
utils
.
SummaryManager
(
if
summary_manager
:
summary_dir
,
tf
.
summary
.
scalar
,
global_step
=
self
.
global_step
)
self
.
summary_manager
=
summary_manager
else
:
self
.
summary_manager
=
utils
.
SummaryManager
(
summary_dir
,
tf
.
summary
.
scalar
,
global_step
=
self
.
global_step
)
self
.
_steps_per_loop
=
steps_per_loop
self
.
_steps_per_loop
=
steps_per_loop
if
self
.
evaluator
is
not
None
:
if
self
.
evaluator
is
not
None
:
...
@@ -210,8 +222,11 @@ class Controller:
...
@@ -210,8 +222,11 @@ class Controller:
# are the same.
# are the same.
self
.
eval_summary_manager
=
self
.
summary_manager
self
.
eval_summary_manager
=
self
.
summary_manager
else
:
else
:
self
.
eval_summary_manager
=
utils
.
SummaryManager
(
if
eval_summary_manager
:
eval_summary_dir
,
tf
.
summary
.
scalar
,
global_step
=
self
.
global_step
)
self
.
eval_summary_manager
=
eval_summary_manager
else
:
self
.
eval_summary_manager
=
utils
.
SummaryManager
(
eval_summary_dir
,
tf
.
summary
.
scalar
,
global_step
=
self
.
global_step
)
tf
.
summary
.
experimental
.
set_step
(
self
.
global_step
)
tf
.
summary
.
experimental
.
set_step
(
self
.
global_step
)
...
...
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