guillaumegenthial / tf_ner

Simple and Efficient Tensorflow implementations of NER models with tf.estimator and tf.data
Apache License 2.0
923 stars 275 forks source link

How to save a model? #2

Closed 1049451037 closed 6 years ago

1049451037 commented 6 years ago

After training a model, how to avoid retraining for the next time?

varshachawan commented 6 years ago

Really appreciate your effort ! @guillaumegenthial but Adding a TF signature for saving model using SavedModel to serve in Tensorflow serving.. adding This code ll make this model a perfect end-to-end ( train - test - Save - Serve )solution for NER. If you could add this would be really helpful for beginners like me

guillaumegenthial commented 6 years ago

@1049451037 once trained, the weights are saved the results directory! Next time you instantiate the same estimator, with the same graph and same model_dir, it will reload the weights.

You can test it with just commenting out train_and_evaluate and simply run python main.py : it will reload the graph and write the same predictions!

gamerrishad commented 6 years ago

Hello @guillaumegenthial what should be the serving_input_fn if we really want to use estimator.export_savedmodel?? I've created a new issue on this.