- Install dependencies
conda env create -f environment.yml -n envname
- Set the
data_dir
andlog_dir
parameters in theconfigs/config.yaml
andconfigs/eval_config.yaml
. Set thetracking_uri
in theconfigs/logger/mlflow.yaml
config file. - For training: Set the
gpu_id
in 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/resnet18
andconfig/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_id
of 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=8
If 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,8
or 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_id
of the training run you want to prune. - Set the type of pruning you want to use in the
configs/experiment/pruning
file, choosing betweenstructured_lr
,structured_random
,unstructured_l1
andunstructured_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_path
in the MlFlow experiment.
- Follow all the steps in the
pruning
guide. - Once you have a pruned model, copy its
compressed_path
in 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=8
Once again you can start a multi-run if you want to quantize the model with different precisions.