Authors: Abhigyan Khaund, Joseph Miano
- Run the following command to set up the conda environment:
- Windows:
conda env create --name smr_env --file smr_env_windows.yml - Linux:
conda env create --name smr_env --file smr_env_linux.yml - Mac:
conda env create --name smr_env --file smr_env_mac.yml
- Windows:
- Activate the conda environment by running:
conda activate smr_env - Keep this environment active throughout the next steps
- Note: you must have a GPU with NVIDIA Drivers configured on your system for the Model Variant Generation part of the examples/demos, since it runs on GPU.
- From
repo_team14, change directory to theexamples/modelsdirectory:cd examples/models - Run the command:
gdown "https://drive.google.com/uc?id=1pG_6ncWFn8Gy4pIaz4Q4EE6JbGmD6RkM" - Unzip the
model-variants.zipfile. The model files should populate theexamples/models/model_variantsdirectory. - If prompted to replace existing files, yes allow the files to be replaced
Note: this example is run first, before the model variant generation example, so the inference demo can leverage the variants we trained on the larger dataset, which were downloaded and extracted in the "Download trained model-variants step." To run the example of the inference system on a small sample dataset -
- Navigate to the
repo_team14directory and open Jupyter notebooks by running:jupyter notebook - Open the notebook -
examples/Inference_System_Demo.ipynb - Once you open the ipynb file of interest, open the "Kernel" menu, then "Change Kernel" and select the smr_env kernel
- Run all cells
- Wait for a few minutes as profiling takes time.
Note: the variants generated here will not perform well due to being trained on a small sample dataset, but this example is intended to show the variant generation process. To run the example of the MTL model variant generation on a small sample dataset -
- Open the notebook -
examples/Generate_Model_Variants_MTL_Example.ipynb - Run all cells
- The model variant files will be created and visible in the
examples/models/model_variantsdirectory.
- Run the command:
gdown "https://drive.google.com/uc?id=18YAbwahQT808HjJ0ZthqX6oKNkYZd-Yf" - unzip all files.
- Run the following command to set up the conda environment:
- Windows:
conda env create --name smr_env --file smr_env_windows.yml - Linux:
conda env create --name smr_env --file smr_env_linux.yml - Mac:
conda env create --name smr_env --file smr_env_mac.yml
- Windows:
- Activate the conda environment by running:
conda activate smr_env - Keep this environment active throughout the next steps
- Note: you must have a GPU with NVIDIA CUDA and Drivers configured on your system for our code to run, since part of the examples/demos run on GPU.
- Note: whenever opening an ipynb file of interest, open the "Kernel" menu, then "Change Kernel" and select the smr_env kernel
Run Generate_Model_Variants_MTL.ipynb to generate all the models-variants for the MTL version of the system.
Run Generate_Model_Variants_SingleTask.ipynb to generate all the model-variants for the single-task version (with no MTL models) of the system.
- Run
inference/Inference.ipynbto simulate the different systems and run the queries on the system and generate the results in the report. RequestDetailscan be used to specify requests to the system- By default, the system runs on CPU hardware. To run it on GPU, replace the followin in
inference/Inference.ipynbandinference/utils.py. -- Replace instances of
model = torch.load(model_path, map_location=torch.device('cpu'))withmodel = torch.load(model_to_use.file_path) - Replace
model.cpu()withmodel.cuda() - Replace
request_details.input_imagewithrequest_details.input_image.cuda() - Replace
output = model(image)withoutput = model(image.cuda())
- Replace instances of
TaskHead_Length_Experiments.ipynbshows our code to test the effect of task head length on latencyPruning_Robustness_Experiments.ipynbshows code testing relationship between pruning amount and accuracyinference/Inference.ipynbshows code testing the system inference performance, including Pareto curves and mishit plots