VirtualLab's CI/CD

The dAIEdge-VLab’s CI/CD pipeline is the main pipeline that is used to run the different scripts. This pipeline is triggered by the dAIEdge-VLab’s user interface or by the functional test pipeline. The pipeline is composed of different stages that are executed in a specific order. Furthermore, it provides several environment variables.

What files does the pipeline provide ?

The CI/CD gives you access to the model, the datasets preprocessed (if available) and a configuration file (if available). Here is a quick look at these two main input file :

  • Model : The model is a pre-trained model given by the user. The format of this model is fixed by you here (e.g. onnx, .tflite). Note that you should be able to determin the input and output size of the model uesing only this file.
  • Dataset : If the $BENCHMARK_TYPE variable is set to TYPE2, a binary file of the dataset preprocessed will be provided. This binary file contains the raw input data that must be used to perfrom the benchmark. The binary file should be composed of INPUT_SIZE_BYTES * NB_SAMPLES bytes. You should ensure the validity of the dataset yourself. You may throw an error if the size is not vaild.
  • On device training configuration : If the $BENCHMARK_TYPE variable is set to TYPE3, a configuration file for the on device training will be provided. This file is a .json file that contains the configuration of the on device training. The file name is given by the environment variable $ODT_CONFIG_FILENAME. Inside this configuration file, the train and test datasets file nammes are given. These files will be available in the root folder of the target source code. The train dataset is used to train the model and the test dataset is used to evaluate the model after training.

Here is an example in python to leverage the use of the environment variables :

use_var.py
import os

model_path = os.environ['MODEL_FILENAME'] # If the work directory is the root foler.

Execution

You can have a look at the complete main pipeline of the dAIEdge-VLab in the file here.

The main stage of the dAIEdge-VLab’s CI/CD pipeline is the build-deploy stage. This stage does the following:

  1. Clones the target source code using the environments variables defined in the Docker Image.
  2. Downloads the model from the package registry at the location target_src/. This directory is the root directory of the target source code.
  3. Downloads the dataset from the package registry at the location target_src/ if needed. This directory is the root directory of the target source code.
  4. Clean all the files and environments variables that are not needed for the target to run.
  5. Runs the target script AI_Support if the error.log is empty.
  6. Runs the target script AI_Build if the error.log is empty.
  7. Runs the target script AI_Deploy if the error.log is empty.
  8. Runs the target script AI_Manager if the error.log is empty.
  9. Finalizes the report automatically. It adds the known values to some keys.
  10. Prints any errors that occurred during the execution of the scripts.
  11. Saves the output of the AI_Manager script in the target_src/AI_Manager/out directory alongside the error.log and user.log files if they exist.
⚠️
Security : If you find any security issues or data leaking regarding the currently stated dAIEdge-VLab implementation, please report it to the maintainers.

Environment variables

This section describes the environment variables that are usefull for the integration of the target.

Variables describing the requested job

Variable name Description
$TARGET The target name
$RUNTIME The runtime name
$NB_INFERENCE The number of inferences that should be performed to create the benchmark. This variable should be ignored if $BENCHMARK_TYPE is set to TYPE2.
$BENCHMARK_TYPE Define the benchmark type requested by the user. See benchmark type for more details.
$MODEL_FILENAME Provide the file name of the model provided by the user. Note that a timestamp is added to it automatically to ensure uniqueness.
$DATASET_FILENAME Provide the file name of the dataset provided by the user. Only if one was provided.
$ODT_CONFIG_FILENAME Provide the file name of the on device training configuration file. Only if the benchmark type is set to TYPE3.

Variables for the dAIEdge-VLab

Variable name Description
$FUNCTIONS_PATH Path of the exit_functions.sh script. This scipt helps handeling errors and wranings.
$LOG_PATH Path of the location of the .log files. This is handeled automatically by the exit_functions.sh.

On device training configuration file

When the benchmark type is set to TYPE3, an on device training configuration file is provided. This file is a .json file that contains the configuration of the on device training. The file name is given by the environment variable $ODT_CONFIG_FILENAME. The content of this file is as follows:

config.json
{
    "learning_parameters" : {
      "batch_size": 32,
      "epochs": 10,
      "loss_function": "sparse_categorical_crossentropy",
      "custom_param_1": "value1",
      "custom_param_2": "value2"
    },
    "input": {
      "name": "input",
      "shape": [28, 28, 1],
      "dtype": "float32",
      "train_file": "mnist_train_input.bin",
      "test_file": "mnist_test_input.bin"
    },
    "output": {
      "name": "output",
      "shape": [],
      "dtype": "int32",
      "train_file": "mnist_train_target.bin",
      "test_file": "mnist_test_target.bin"
    }
}

The input and output keys contain the information about the input and output data used for the on device training. The train_file and test_file keys contain the file names of the train and test datasets. The learning_parameters key contains the learning parameters used for the on device training. Note that the custom_param_1 and custom_param_2 are custom parameters that can be renamed for your need. You can also add more custom parameters if needed. If the user does not provide a value for a given key, especially for your custom parameters, you should throw an error in the error.log file to inform the user of the missing parameters.