Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.tensorflow
Commits
8ee9b4ae
Commit
8ee9b4ae
authored
6 years ago
by
Amir MOHAMMADI
Browse files
Options
Downloads
Patches
Plain Diff
eval: Handle failed copying too
parent
6cb3a7f5
No related branches found
No related tags found
1 merge request
!73
Improvements to eval script
Pipeline
#27556
failed
6 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/script/eval.py
+8
-2
8 additions, 2 deletions
bob/learn/tensorflow/script/eval.py
with
8 additions
and
2 deletions
bob/learn/tensorflow/script/eval.py
+
8
−
2
View file @
8ee9b4ae
...
...
@@ -22,7 +22,7 @@ from bob.io.base import create_directories_safe
logger
=
logging
.
getLogger
(
__name__
)
def
copy_one_step
(
train_dir
,
global_step
,
save_dir
):
def
copy_one_step
(
train_dir
,
global_step
,
save_dir
,
fail_on_error
=
False
):
for
path
in
glob
(
'
{}/model.ckpt-{}.*
'
.
format
(
train_dir
,
global_step
)):
dst
=
os
.
path
.
join
(
save_dir
,
os
.
path
.
basename
(
path
))
if
os
.
path
.
isfile
(
dst
):
...
...
@@ -34,6 +34,8 @@ def copy_one_step(train_dir, global_step, save_dir):
logger
.
warning
(
"
Failed to copy `%s
'
over to `%s
'"
,
path
,
dst
,
exc_info
=
True
)
if
fail_on_error
:
raise
def
save_n_best_models
(
train_dir
,
save_dir
,
evaluated_file
,
...
...
@@ -255,7 +257,11 @@ def eval(estimator, eval_input_fn, hooks, run_once, eval_interval_secs, name,
# copy over the checkpoint before evaluating since it might
# disappear after evaluation.
copy_one_step
(
estimator
.
model_dir
,
global_step
,
eval_dir
)
try
:
copy_one_step
(
estimator
.
model_dir
,
global_step
,
eval_dir
,
fail_on_error
=
True
)
except
Exception
:
# skip testing this checkpoint
continue
# evaluate based on the just copied checkpoint_path
checkpoint_path
=
checkpoint_path
.
replace
(
estimator
.
model_dir
,
eval_dir
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment