Save/Load Tensorflow models

I’m having trouble on saving/loading Tensorflow models.

The same code works on Google colab but not for submission environment.
I used tf.saved_model.save(model, {path}) and models.load_model({path}). It should create a folder named {path} containing the model files but the following error is resulted instead.

Logs
OSError: SavedModel file does not exist at: trained_model/{saved_model.pbtxt|saved_model.pb}

Submission ID: 116530

Hi @hologrampeter and welcome :partying_face:!

So I went into your model and I can’t see your saved object uploaded. I can see that you are using zip submissions so you should have been able to upload everything.

Can you confirm that you are actually uploading a saved model file somewhere inside your zip folder?

Also could you downgrade to tensorflow=2.2 for now?

@alfarzan Thanks for the reminder! After I reuploaded the saved model file and downgraded tensorflow, it now gives a different error message:

This function does not handle the case of the path where all inputs are not already EagerTensors.

Again, I was able to load the model just fine on Google Colab. I have to download the model and submit using zip as the python notebook failed to copy the model when running %aicrowd_submit.

Hmm ok that’s interesting! Thanks for figuring that piece of the puzzle out :bulb:

I will pass this on to @jyotish who knows the details of how the colab script saves and loads the necessary files.

Having said that, once you do download and upload via zip does it work? and if not can you give us a submission number to see what we can do?

Uploading via zip does not work, unfortunately. The submission number is 116627.

As for the colab upload script, Tensorflow saves the model as multiple files in a folder. I wonder if that’s what caused the issue.

Thank you so much for your help :smile:

Hi @hologrampeter

I’ve been looking for a fix for this from our side to no avail as of yet :thinking:

Stay tuned :headphones:

I also recommend trying another “backup” model before the deadline tonight to make sure you play in the markets tonight!