This page provides basic tutorials about the usage of iNAS. Please run the commands in the root path of iNAS
.
In general, both the training and testing include the following steps:
- Prepare datasets.
- Modify config files. The config files are under the
options
folder. For more specific configuration information, please refer to Config.md. - You may need to download pre-trained models. Please see ModelZoo
- Run commands. Use Training Commands, Searching Commands, Converting Commands and Testing Commands accordingly.
- Training Commands
- Searching Commands 3. Benchmark Latency Lookup Table on Devices 4. Single GPU Searching
- Converting Commands
- Testing Commands
CUDA_VISIBLE_DEVICES=0 python iNAS/train.py -opt [config file]
4 GPUs (default)
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port=4321 iNAS/train.py -opt options/train/SOD/train_supernet_sod_4gpu_b10_e100_noaug.yml --launcher pytorch
Here, we provide a sample latency lookup table (Baidu Drive (f3au) | Google Drive) tested on Intel Core CPU. You can generate it yourself by following command:
Generate the latency lookup table template (lut_template.txt) based on our search space.
python scripts/build_latency_table/build_latency_lut_template.py
Use the template file, we can benchmark the component latency on different devices by running the following commands:
python scripts/build_latency_table/compute_lut_on_devices.py
For mobile phone, this command only generate jit models. We need to benchmark it on mobile phones by Pytorch Mobile. Key codes can be found in scripts/build_latency_table/mobile_scripts
.
CUDA_VISIBLE_DEVICES=0 \
python iNAS/search.py -opt options/search/SOD/search_iNAS_1gpu_iter10.yml
We can convert the supernet weight for each stand-alone models (initialized by json configuration) using the following command:
CUDA_VISIBLE_DEVICES=0 \
python iNAS/search.py -opt options/convert/SOD/convert_sod.yml
We benchmark the stand-alone model accuracy on different SOD test set by the following command:
CUDA_VISIBLE_DEVICES=0 \
python iNAS/test.py -opt options/test/SOD/test_standalone_sod.yml