Open OmarAlsaqa opened 3 years ago
Hi,
This is how I manage to transfer my nmt model from trax to keras. Maybe this helps you out on your issue. I am still struggling how to best host this model then in an efficient way in tf_serving. If you find out sth, keep me posted. :)
All the best, Matthias
model = trax.models.Transformer(
input_vocab_size=32768,
d_model=512, d_ff=1024,
n_heads=8, n_encoder_layers=6, n_decoder_layers=6,
max_len=1024,
mode='eval' )
model.init_from_file( model_folder+'/model.pkl.gz' )
keras_layer = trax.AsKeras(model, batch_size=1)
inputs = tf.keras.Input(shape=(1024,), dtype='int32')
hidden = keras_layer((inputs, inputs))
outputs = hidden
keras_model = tf.keras.Model(inputs=inputs, outputs=outputs)
Hi,
This is how I manage to transfer my nmt model from trax to keras. Maybe this helps you out on your issue. I am still struggling how to best host this model then in an efficient way in tf_serving. If you find out sth, keep me posted. :)
All the best, Matthias
model = trax.models.Transformer( input_vocab_size=32768, d_model=512, d_ff=1024, n_heads=8, n_encoder_layers=6, n_decoder_layers=6, max_len=1024, mode='eval' ) model.init_from_file( model_folder+'/model.pkl.gz' ) keras_layer = trax.AsKeras(model, batch_size=1) inputs = tf.keras.Input(shape=(1024,), dtype='int32') hidden = keras_layer((inputs, inputs)) outputs = hidden keras_model = tf.keras.Model(inputs=inputs, outputs=outputs)
Do you have any updates on this?
Description
I tried many times to convert diffrent models to keras but I always face a problem. I found on Gitter many answers like this one can any one help me.
Environment information
For bugs: reproduction and error logs