This tutorial contains a minimal example of training a cost model and using it for search.
Build and install this fork of TVM following the guide.
You can choose use either the CPU part or the GPU part.
- Download
- You can download it from google drive with the link dataset_cpu_v3.3.zip
- Or you can use the command line
pip3 install gdown gdown https://drive.google.com/uc?id=1JQwGEe8jCpuhZPnUxO0Sb1CJJ06uevy6
- Unzip
Putdataset_cpu_v3.3.zip
undertenset/scripts
and rununzip dataset_cpu_v3.3.zip
. A new folderdataset_cpu
will appear intenset/scripts
. Make 'dataset' as a softlink to it byln -s dataset_cpu dataset
.
- Download
- You can download it from google drive with the link dataset_gpu_v3.3.zip
- Or you can use the command line
pip3 install gdown gdown https://drive.google.com/uc?id=1jqHbmvXUrLPDCIqJIaPee_atsPc0ZFFK
- Unzip
Putdataset_gpu_v3.3.zip
undertenset/scripts
and rununzip dataset_gpu_v3.3.zip
. A new folderdataset_gpu
will appear intenset/scripts
. Make 'dataset' as a softlink to it byln -s dataset_gpu dataset
.
Use the CPU part of the dataset and go to tenset/scripts
.
- Make a dataset
You can either
- create a sampled smaller dataset for fast experiments.
python3 make_dataset.py --logs dataset/measure_records/e5-2673/*.json --sample-in-files 100
- create a complete dataset by using all files. This takes a longer time and requires more memory.
python3 make_dataset.py --logs dataset/measure_records/e5-2673/*.json
- Train a cost model
python3 train_model.py
- Use the model for search
python3 tune_network.py --network resnet_50 --n-trials 100 --cost-model xgb-no-update --load-model xgb.pkl
- Dataset
- Make a dataset with a certain number of tasks and a certain number of measurements per task. E.g.
python3 make_dataset.py --logs dataset/measure_records/e5-2673/*.json --n-task 200 --n-measurement 200
- Make a hold-out dataset. E.g. hold out all tasks appeared in resnet-50
python3 make_dataset.py --logs dataset/measure_records/e5-2673/*.json --hold-out resnet-50
- Make a dataset with a certain number of tasks and a certain number of measurements per task. E.g.
- Model training
- Specify the type of model. E.g.
python3 train_model.py --models mlp
- Specify the type of model. E.g.
- Search
*Note that we might need to specify the target argument depending on the machine type.
- No pre-trained model, and train a model online. E.g.
python3 tune_network.py --network resnet_50 --n-trials 100 --cost-model xgb --target "llvm -mcpu=skylake-avx512"
- Use a pre-trained model. E.g.
python3 tune_network.py --network resnet_50 --n-trials 100 --cost-model mlp-no-update --load-model mlp.pkl
- Use transfer-learning. E.g.
python3 tune_network.py --network resnet_50 --n-trials 100 --cost-model mlp-no-update --load-model mlp.pkl --transfer-tune
- No pre-trained model, and train a model online. E.g.