- Install dependencies
conda env create -f environment.yml -n envname - Set the
data_dirandlog_dirparameters in theconfigs/config.yamlandconfigs/eval_config.yaml. Set thetracking_uriin theconfigs/logger/mlflow.yamlconfig file. - For training: Set the
gpu_idin the config file to the gpu you want to use. - Run an experiment using
python3 main.py +experiment=exp_name
The experiments wil be automatically tracked using MlFlow. The tracking dashboard can be accessed by starting the mlflow client in the directory of the tracking_uri using mlflow ui.
- Choose the model that you want to train e.g.
config/experiment/resnet18. - Set the hyperparameters in the
config/model/resnet18andconfig/experiment/resnet18. - Run the experiment
python3 main.py +experiment=resnet18 - Start the MlFlow client to track the training.
- Start the MlFlow client and choose a model that you want to quantize. Each run has an unique
experiment_id, copy theexperiment_idof the training run you want to quantize. - Start quantization by running:
python3 evaluation.py +experiment=quantization exp_id={your_exp_id} quantization.activation_precision=7 quantization.weight_precision=8If you want to quantize a model with multiple different precisions in order to compare them you can start a multi-run:
python3 evaluation.py -m +experiment=quantization exp_id={your_exp_id} quantization.activation_precision=2,3,4,5,6,7 quantization.weight_precision=2,3,4,5,6,7,8or check out scripts/evaluate_quantization.py
3. Check the results using the MlFlow dashboard.
- Start the MlFlow client and choose a model that you want to prune. Each run has an unique
experiment_id, copy theexperiment_idof the training run you want to prune. - Set the type of pruning you want to use in the
configs/experiment/pruningfile, choosing betweenstructured_lr,structured_random,unstructured_l1andunstructured_random. - Set the pruning hyperparameters (number of iterations, amount to prune in each iteration etc.) in the respective configuration file
config/pruning/{type}. - Start pruning by running:
python3 evaluation.py +experiment=pruning exp_id={your_exp_id}- Check the results using the MlFlow dashboard. Note that each pruned model is saved in the directory that is saved as
compressed_pathin the MlFlow experiment.
- Follow all the steps in the
pruningguide. - Once you have a pruned model, copy its
compressed_pathin the MlFlow dashboard. - Start quantization by running
python3 evaluation.py +experiment=quantization exp_id={your_exp_id} compressed_path={your_compressed_path} quantization.activation_precision=7 quantization.weight_precision=8Once again you can start a multi-run if you want to quantize the model with different precisions.