Help with saving and loading model

Hi
I am unable to understand where and how to save my model. What am I supposed to type in this cell?
Thanks

Hi @taha_hussain,

You need to write the code to save any artifacts/models in AICROWD_ASSETS_DIR variable i.e. path to the assets folder in this code block.


A simpler example, in case you want to save abc.txt.

Save your trained model

with open(AICROWD_ASSETS_DIR + "abc.txt", "w") as f:
    f.write("42")

Prediction phase

magic_number = open(AICROWD_ASSETS_DIR + "abc.txt").read()

Advanced examples are available in notebooks shared by participants like:

1. EDA, FE, HPO - All you need (LB: 0.640)

2. End-to-End Simple Solution (9 Models + Data Imbalance)

and so on…

2 Likes

“Not a directory error” keeps cropping up when I try to save my model.
Here is the code:
learn.export(AICROWD_ASSETS_DIR + ‘/fai_model1.mdl’)

and the error:

I even tried to follow the All You Need and End to End notebooks, but then no such file/directory error comes up.

How did you define your AICROWD_ASSETS_DIR ?

It looks like it has been defined as the same your AICROWD_DATASET_PATH.

2 Likes