Skip to content

Machine Learning: Model Retraining

qedk edited this page Nov 13, 2020 · 1 revision

You can easily retrain the model using the model.h5 file available in the module.

import keras

model = keras.load_model("model.h5")
# Do retraining as required

If that's not your style, we also provide a makemodel.py file to generate the model how you want to train it or if you just want to tinker around.

$ python3 makemodel.py

Comments have been provided in the script to make things easier to understand.

Please note that the datasets are imported from Kaggle and need to be set up either in a kernel or locally before running the script. There are also additional dependencies on tweet-preprocessor, pandas and emoji.

If you are not running on a TPU, you can expect the training process to take around 1 minute per epoch (on a GPU). You might need to tweak the batch size if your GPU RAM has a lower than expected capacity.