Tensor2tensor: Exporting Trained Models with SavedModel API

Created on 9 Jul 2017  路  4Comments  路  Source: tensorflow/tensor2tensor

Currently, as far as I can tell, t2t-trainer only saves model checkpoints. It would be useful if there was a flag which also indicated that a SavedModel should be produced (perhaps by just adding a simple ExportStrategy to the Experiment which is created). This would allow models trained with tensor2tensor to be loaded by things like the TensorFlow Java API bindings. Would this make sense to add?

(Apologies if I'm just misunderstanding something and there's already a way to do this)

Most helpful comment

Yes, done, thanks!

All 4 comments

Yes! I think we just forgot about SavedModel, it would be very good to add. A PR is more than welcome!

It seems that model export has already implemented.

Yes, done, thanks!

Hi @lukaszkaiser, @belph.

I have exported a frozen graph of the Transformer network.
Now I would like to use it through the Java API.

My problem is that I do not know how to specify the name of the input and output layers here:

Tensor<Double> output = session
                .runner()
                .feed("input", input)
                .fetch("output")
                .run()
                .get(0)
Was this page helpful?
0 / 5 - 0 ratings