Warmstart for Native Keras Model in TFX
See original GitHub issueThank you for submitting a TFX documentation issue. Per our GitHub policy, we only address code/doc bugs, performance issues, feature requests, and build/installation issues on GitHub and we welcome external contributions!
The TFX docs are open source! To get involved, please read the documentation contributor guide: https://www.tensorflow.org/community/contribute/docs
URL(s) with the issue:
Please provide a link to the documentation entry>> [1] https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_pipeline_warmstart.py [2] https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_pipeline_native_keras.py
Description of issue (what needs changing): Example on Warmstart for Native Keras Model TFX pipeline
Clear description:
I am looking for examples of Native Keras model tfx pipeline, where it allows warmstart of the model so for future training on new dataset, the model can continue training instead of re-compiling the whole model and retrain from beginning on new dataset.
Link in [1] above shows an example on how a tensorflow estimator with warmstart can be set-up, however the only example on keras model tfx pipeline in [2] does not cover this component.
Does it follow the same configuration as the estimator component? To be more specific, can the code below be used in a keras model pipeline (taken from estimator example)?
# Get the latest model so that we can warm start from the model.
latest_model_resolver = ResolverNode(
instance_name='latest_model_resolver',
resolver_class=latest_artifacts_resolver.LatestArtifactsResolver,
latest_model=Channel(type=Model))
Correct links
Is the link to the source code correct? Yes
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@chongkong ,
Thanks, that’s the clarification i was after! So just to confirm my understanding, below would be how it looks like in the pipeline and processing code.
## Pipeline Code
## Processing_Util code
@chongkong ,
I’ve ran a quick test of this today in Google Colab environment. As far as getting the previous model is concerned, it can get the previous trained model fine for any warmstart.
However, i did notice during training for the warmstart it did produce a warning message:
First Model Training - no base model at this stage so start training from scratch
WarmStart Model Training - toggle warmstart to True so pipeline will locate previously trained model and train further from there
The loss for the warmstart model looks to be higher than the first model’s last epoch loss, but then it does reduce further then the first model as the epoch progresses which is good sign it is learning further from the warmstart.
Not too sure if the warning message
Model failed to serialize as JSON. Ignoring...
is something of concern?model.fit
andmodel.predict
is still working for the warmstart modelFYI i was using the taxi example for keras in this exercise >>
https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_pipeline_native_keras.py https://github.com/tensorflow/tfx/blob/master/tfx/examples/chicago_taxi_pipeline/taxi_utils_native_keras.py