Is there a way to call functions from a reloaded tf.module model?

Viewed 9

I'm currently working on a Project and I'm lost encountering this problem, I want to save the model I created call the function when I needed to reload it. The module I created is something like this:

class beamModule(tf.Module):
    def __init__(self,encode,decode,optimizer,transConfig):
    ...
    def translate(self,sentences):
    ...
        return bestTranslation

Well this produced a great output when I run it normally and whenever I save the model these warnings appear:

tf.saved_model.save(modelTranslator,'enilo-model')

WARNING:absl:Found untraced functions such as encoder_layer_call_fn, encoder_layer_call_and_return_conditional_losses, decoder_layer_call_fn, decoder_layer_call_and_return_conditional_losses, embedding_layer_call_fn while saving (showing 5 of 24). These functions will not be directly callable after loading.

And lastly when I reload the model

reloaded = tf.saved_model.load('enilo-model')
result = reloaded.translate('what are you doing')

this error prompt appears

AttributeError: '_UserObject' object has no attribute 'translate'

I’m currently lost, thank you in advance for attending to my questions.

0 Answers
Related