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
dbdf712e
Commit
dbdf712e
authored
Jun 05, 2019
by
guptapriya
Committed by
guptapriya
Jun 04, 2019
Browse files
make training input handling in keras fit case the same as CTL case
parent
5b81bb59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
official/recommendation/ncf_keras_main.py
official/recommendation/ncf_keras_main.py
+1
-5
No files found.
official/recommendation/ncf_keras_main.py
View file @
dbdf712e
...
@@ -93,8 +93,6 @@ def _get_train_and_eval_data(producer, params):
...
@@ -93,8 +93,6 @@ def _get_train_and_eval_data(producer, params):
train_input_fn
=
producer
.
make_input_fn
(
is_training
=
True
)
train_input_fn
=
producer
.
make_input_fn
(
is_training
=
True
)
train_input_dataset
=
train_input_fn
(
params
).
map
(
train_input_dataset
=
train_input_fn
(
params
).
map
(
preprocess_train_input
)
preprocess_train_input
)
if
not
params
[
"keras_use_ctl"
]:
train_input_dataset
=
train_input_dataset
.
repeat
(
FLAGS
.
train_epochs
)
def
preprocess_eval_input
(
features
):
def
preprocess_eval_input
(
features
):
"""Pre-process the eval data.
"""Pre-process the eval data.
...
@@ -286,8 +284,7 @@ def run_ncf(_):
...
@@ -286,8 +284,7 @@ def run_ncf(_):
eval_input_dataset
=
eval_input_dataset
.
batch
(
batches_per_step
)
eval_input_dataset
=
eval_input_dataset
.
batch
(
batches_per_step
)
time_callback
=
keras_utils
.
TimeHistory
(
batch_size
,
FLAGS
.
log_steps
)
time_callback
=
keras_utils
.
TimeHistory
(
batch_size
,
FLAGS
.
log_steps
)
per_epoch_callback
=
IncrementEpochCallback
(
producer
)
callbacks
=
[
time_callback
]
callbacks
=
[
per_epoch_callback
,
time_callback
]
if
FLAGS
.
early_stopping
:
if
FLAGS
.
early_stopping
:
early_stopping_callback
=
CustomEarlyStopping
(
early_stopping_callback
=
CustomEarlyStopping
(
...
@@ -388,7 +385,6 @@ def run_ncf(_):
...
@@ -388,7 +385,6 @@ def run_ncf(_):
keras_model
.
compile
(
optimizer
=
optimizer
)
keras_model
.
compile
(
optimizer
=
optimizer
)
history
=
keras_model
.
fit
(
train_input_dataset
,
history
=
keras_model
.
fit
(
train_input_dataset
,
steps_per_epoch
=
num_train_steps
,
epochs
=
FLAGS
.
train_epochs
,
epochs
=
FLAGS
.
train_epochs
,
callbacks
=
callbacks
,
callbacks
=
callbacks
,
validation_data
=
eval_input_dataset
,
validation_data
=
eval_input_dataset
,
...
...
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