tensorflow / tensor2tensor

Library of deep learning models and datasets designed to make deep learning more accessible and accelerate ML research.
Apache License 2.0
15.5k stars 3.49k forks source link

How to deploy the transformer model? #1276

Closed kFoodie closed 5 years ago

kFoodie commented 5 years ago

After training the model with transformer, how do you know which tensor is the input and which tensor is the output. That is, how to use the model to read user input, translate it in the model, and then output the corresponding sentence.

the code:

sess = tf.Session()
saver = tf.train.import_meta_graph('./checkpoint_test/average-0.meta')
saver.restore(sess, tf.train.latest_checkpoint('./checkpoint_test/'))

I want to use flask to deploy the model online.

afrozenator commented 5 years ago

Hi @kFoodie - Can you check this out? https://github.com/tensorflow/tensor2tensor/tree/master/tensor2tensor/serving

That should provide some information.