Artificial Neural Networks and Deep Learning 2021 - Homework 1 Forum

Go back to competition Back to thread list Post in this thread

> Model Submission [ERROR]

Today I tried to submit the .zip file containing model.py, metadata and the folder SubmissionModel containing the tf model saved as a checkpoint in .h5.
This is what I put in model.py:
import os
import tensorflow as tf

class model:
def __init__(self, path):
self.model = tf.keras.models.load_model(os.path.join(path, 'SubmissionModel'))

def predict(self, X):
out = self.model.predict(X)
out = tf.argmax(out, axis=-1)
return out

I put my model.h5 in the folder 'SubmissionModel', as specified in the challenge's description.
I zipped the whole thing and tried to submit and I got this error:
...
OSError: SavedModel file does not exist at: /multiverse/storage/lattari/Prj/phd/AN2DL/Competition_1_running_dir/worker_gpu0_dir/tmp/codalab/tmpFpVYhT/run/input/res/SubmissionModel/{saved_model.pbtxt|saved_model.pb}

Posted by: EugenioBertolini @ Nov. 14, 2021, 9:04 p.m.

I think it does not expect a h5 file.
Try to save with model.save('path'). You should get a folder, not a single file.
Take a look at this: https://www.tensorflow.org/guide/keras/save_and_serialize

Posted by: stefanomaxenti @ Nov. 15, 2021, 4:07 p.m.

I solved it. I just had to put 'folder/model.h5' in the path to make it work.

Posted by: EugenioBertolini @ Nov. 15, 2021, 7:01 p.m.

I mean: 'SubmissionModel/model.h5'

Posted by: EugenioBertolini @ Nov. 15, 2021, 7:02 p.m.
Post in this thread