Informations

Auteur(s) Benoît Ronval, Pierre Dupont
Date limite 10/05/2026 23:00:00
Limite de soumission 2 soumissions
toutes les 1 heure(s)

Se connecter

Deep model training

You may use this task to train a deep learning model using GPUs available through Inginious. The GPUs have a memory (VRAM) of 12GB.

Warning: your are limited to 2 submissions per hour! Each submission has a time out of 14 minutes.

Copy paste the code to be executed in the space below. Once the task is done, you will receive an email (at your uclouvain address) with a .zip archive containing any file that you saved in student/data/

You may also upload a model checkpoint to continue the training. Use the second question to upload either a .keras or a .zip file containing your .keras models. You will then be able to load your model in your code in question 1.

Note that the data are preloaded and are the ones for the project 5.


Question 1: Code to run

Paste here the code to create and run your model.

Suppose the training set is loaded in the variable x_train and the corresponding labels in y_train.

Suppose the test set is loaded in the variable x_test.

No preprocessing was done on the loaded data!

IMPORTANT: You must save your model(s) and other files (e.g., log files) in the student/data/ folder. It will be sent to you by email once the task is done (check your spams if needed). Even if the download website indicates that the files are not available, still check your download folder once you have clicked on the download link.

IMPORTANT: In case of a time out, you must store your model in a global variable named model (if you have a single model), or in a global dictionary named models, where the keys are the arbitrary names of your models and the values are the actual Keras models. If the task time out, we will save the model(s) in these variables (and ONLY these ones) and send them to you by email such that you can continue your training from the last completed epoch. Note that you must assign model or models before starting your training loop.

IMPORTANT: if you do NOT use the model.fit() function to train your model and still want to know at which epoch your model was interrupted in case of a time out, you MUST put report_epoch(epoch) in your training loop at the end of each epoch, where epoch is the number (int) of the epoch that just ended.

Question 2: Upload your model(s) checkpoint

Upload a file here. It can either be a .keras file containing a single model or a .zip file containing multiple models.

You can load your uploaded file in the code above. Once uploaded, your file will be located in student/upload/name_of_your_file. It is up to you to open it, either by loading the model through Keras or by unzipping it and loading the models afterwards.

You have to handle the training, and especially the epochs handling. Thus, if you must train your model for 100 epochs and 42 epochs have already been completed in your uploaded checkpoint, you must set your training loop to train for 58 epochs and not 100 epochs!

Due to Inginious constraints, you must upload a file in this task. However, you are not forced to load it in your code above.

If you need to upload a .zip file and retrieve the Keras models it contains, you can use the following code snippet:

import zipfile
import tempfile

uploaded_models = {}
with zipfile.ZipFile("replace_with_your_zip_name.zip", 'r') as zip_ref:
    for name in zip_ref.namelist():
        if not name.endswith(".keras"):
            continue
        model_bytes = zip_ref.read(name)
        with tempfile.NamedTemporaryFile(suffix=".keras") as tmp:
            tmp.write(model_bytes)
            tmp.flush()
            model = keras.models.load_model(tmp.name)
        uploaded_models[name] = model

Taille fichier max. : 238.4 MiB
Extensions autorisées : .keras, .zip