Outside code cell submission

I create my model on a google colab cell so I can call it from pre_training_phase function, the purchase_phase function, and the prediction_phase function. When I submit all the code, that google colab cell is not added to the run.py file so the AIcrowd bot adds the fail tag to the submission code.
Any tips on how to have access to the Keras model from all the functions and submit it to the repo?

Answering to the best of my knowledge on the subject -
Since you are using the Google Colab method to make your submission, you are not supposed to write any code outside the defined functions i.e. pre_training_phase, purchase_phase, prediction_phase. To verify this you can check the code in the “Magic Box” section.
Whoever wrote the notebook submission method has done an incredible job. Although as easy as it sounds to make a submission using colab, it’s not the case. The run.py file they are referring to is almost empty, it only consists of a skeleton and we are supposed to fill it up with some real muscles i.e. add working code in there. I see two options for you:

  1. Put your model initialization code (anything important that is outside of functions) inside the functions.
    Pros: You can make everything in self-contained functions
    Cons: You won’t be able to use checkpointing feature which means you have train the model again in all the functions. It is not at all a good method, because you’ll end up writing the code again and again.
  2. You can make option 1 work well if you can put your model initialization code in run.py which is located in your colab->content->data-purchasing-challenge-2022-starter-kit->run.py. You will also have to write relevant code in save_checkpoint and load_checkpoint. With this, now you can write code in colab functions that will use your model with proper checkpointing and you’ll not have to train the model again.

I am sorry if the solution is not so clear to you. I would suggest you go through this notebook: AIcrowd | Create your baseline with 0.4+ on LB (Git Repo and Video) | Posts. Although it is written in PyTorch, not in Keras, I think you just need an idea of what code should be written where.

1 Like

We will be posting an end to end notebook submission example soon with a baseline included. Hopefully that should be helpful.
@shivam is the main POC for the same.

1 Like