MeCo/README.md

65 lines
1.9 KiB
Markdown
Raw Normal View History

2023-05-04 07:58:22 +02:00
# MeCo: Zero-Cost Proxy for NAS Via Minimum Eigenvalue of Correlation on Feature Maps
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
## Installation
2023-05-04 07:09:03 +02:00
```
Python >= 3.6
2023-05-04 07:58:22 +02:00
PyTorch >= 2.0.0
nas-bench-201
2023-05-04 07:09:03 +02:00
```
2023-05-04 07:58:22 +02:00
## Preparation
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
1. Download three datasets (CIFAR-10, CIFAR-100, ImageNet16-120) from [Google Drive](https://drive.google.com/drive/folders/1T3UIyZXUhMmIuJLOBMIYKAsJknAtrrO4), place them into the directory `./data`
2. Download the [`data` directory](https://drive.google.com/drive/folders/18Eia6YuTE5tn5Lis_43h30HYpnF9Ynqf?usp=sharing) and save it to the root folder of this repo.
3. Download the benchmark files of NAS-Bench-201 from [Google Drive](https://drive.google.com/file/d/1SKW0Cu0u8-gb18zDpaAGi0f74UdXeGKs/view) , put them into the directory `./data`
4. Download the [NAS-Bench-101 dataset](https://storage.googleapis.com/nasbench/nasbench_only108.tfrecord), put it into the directory `./data`
5. Install `zero-cost-nas`
```bash
cd zero-cost-nas
pip install .
cd ..
```
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
## Usage/Examples
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
### Correlation Experiment
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
```bash
cd correlation
python NAS_Bench_101.py
python NAS_Bench_201.py
2023-05-04 07:09:03 +02:00
```
2023-05-04 07:58:22 +02:00
### Experiments on NAS-Bench-201
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
1. Run Zero-Cost-PT with appointed zero-cost proxy:
```bash
cd exp_scripts
bash zerocostpt_nb201_pipline.sh --metric [metric] --batch_size [batch_size] --seed [seed]
2023-05-04 07:09:03 +02:00
```
2023-05-04 07:58:22 +02:00
You can choice metric from `['snip', 'fisher', 'synflow', 'grad_norm', 'grasp', 'jacob_cov','tenas', 'zico', 'meco'] `
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
### Experiments on DARTS-CNN Space
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
#### 1. DARTS CNN Space
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
```bash
cd exp_scripts
bash zerocostpt_darts_pipline.sh --metric [metric] --batch_size [batch_size] --seed [seed]
2023-05-04 07:09:03 +02:00
```
2023-05-04 07:58:22 +02:00
#### 2. DARTS Subspaces S1-S4
2023-05-04 07:09:03 +02:00
2023-05-04 07:58:22 +02:00
````bash
cd exp_scripts
bash zerocostpt_darts_pipline.sh --metric [metric] --batch_size [batch_size] --seed [seed] --space [s1-s4]
````
2023-05-04 07:09:03 +02:00
## Reference
2023-05-04 07:58:22 +02:00
Our code is based on [Zero-Cost-PT](https://github.com/zerocostptnas/zerocost_operation_score) and [Zero-Cost-NAS](https://github.com/SamsungLabs/zero-cost-nas).