UniversalAlgorithmic commited on
Commit
56c67bf
Β·
verified Β·
1 Parent(s): f83ae64

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -141
README.md CHANGED
@@ -1,60 +1,67 @@
1
  # SPG: Sequential Policy Gradient for Adaptive Hyperparameter Optimization
2
 
3
 
4
- ## Model zoo
5
- We provide baseline models and SPG-trained models, all available for download at the following links:
6
 
7
 
8
- `Table 1: Model comparison on the ImageNet-1K dataset.`
9
- | Model | SPG | # Params | Acc@1 (%) | Acc@5 (%) | Weights |
10
- |-------|------|----------|-----------|-----------|---------|
11
- | MobileNet-V2 | ❌ | 3.5 M | 71.878 | 90.286 | <a href='https://download.pytorch.org/models/mobilenet_v2-b0353104.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
12
- | MobileNet-V2 | βœ… | 3.5 M | 72.104 | 90.316 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/mobilenet_v2/model_32.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/mobilenet_v2-yellow'></a> |
13
- | ResNet-50 | ❌ | 25.6 M | 76.130 | 92.862 | <a href='https://download.pytorch.org/models/resnet50-0676ba61.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
14
  | ResNet-50 | βœ… | 25.6 M | 77.234 | 93.322 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/resnet50/model_35.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/resnet50-yellow'></a> |
15
- | EfficientNet-V2-M | ❌ | 54.1 M | 85.112 | 97.156 | <a href='https://download.pytorch.org/models/efficientnet_v2_m-dc08266a.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
16
  | EfficientNet-V2-M | βœ… | 54.1 M | 85.218 | 97.208 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/efficientnet_v2_m/model_7.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/efficientnet_v2_m-yellow'></a> |
17
- | ViT-B16 | ❌ | 86.6 M | 81.072 | 95.318 | <a href='https://download.pytorch.org/models/vit_b_16-c867db91.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
18
  | ViT-B16 | βœ… | 86.6 M | 81.092 | 95.304 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/vit_b_16/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/vit_b_16-yellow'></a> |
19
 
20
 
21
- `Table 2: All models are evaluated a subset of COCO val2017, on the 21 categories (including
22
- "background") that are present in the Pascal VOC dataset.`
23
 
24
- `All model reported on TorchVision (with weight COCO_WITH_VOC_LABELS_V1) were benchmarked using only 20 categories. Researchers should first download the pre-trained model from TorchVision and conduct re-evaluation under the 21-category framework.`
25
 
26
- | Model | SPG | # Params | mIoU (%) | pixelwise Acc (%) | Weights |
27
- |---------------------|-----|----------|------------|---------------------|---------|
28
- | FCN-ResNet50 | ❌ | 35.3 M | 58.9 | 90.9 | <a href='https://download.pytorch.org/models/fcn_resnet50_coco-1167a1af.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
 
 
29
  | FCN-ResNet50 | βœ… | 35.3 M | 59.4 | 90.9 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/fcn_resnet50/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/fcn_resnet50-yellow'></a> |
30
- | FCN-ResNet101 | ❌ | 54.3 M | 62.2 | 91.1 | <a href='https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
31
  | FCN-ResNet101 | βœ… | 54.3 M | 62.4 | 91.1 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/fcn_resnet101/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/fcn_resnet101-yellow'></a> |
32
- | DeepLabV3-ResNet50 | ❌ | 42.0 M | 63.8 | 91.5 | <a href='https://download.pytorch.org/models/deeplabv3_resnet50_coco-cd0a2569.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
33
  | DeepLabV3-ResNet50 | βœ… | 42.0 M | 64.2 | 91.6 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/deeplabv3_resnet50/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/deeplabv3_resnet50-yellow'></a> |
34
- | DeepLabV3-ResNet101 | ❌ | 61.0 M | 65.3 | 91.7 | <a href='https://download.pytorch.org/models/deeplabv3_resnet101_coco-586e9e4e.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> |
35
  | DeepLabV3-ResNet101 | βœ… | 61.0 M | 65.7 | 91.8 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/deeplabv3_resnet101/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/deeplabv3_resnet101-yellow'></a> |
36
 
37
 
38
- `Table 3: Performance of models for transfer learning trained with fine-tuning (FT) vs. SPG.`
39
- | Task | SPG | Metric Type | Performance (%) | Weights |
40
- |-------|------|------------------|-----------------|---------|
41
- | CoLA | ❌ | Matthews coor | 56.53 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
 
 
 
 
 
42
  | CoLA | βœ… | Matthews coor | 62.13 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/cola'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/CoLA-yellow'></a> |
43
- | SST-2 | ❌ | Accuracy | 92.32 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
44
  | SST-2 | βœ… | Accuracy | 92.54 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/sst2'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/SST2-yellow'></a> |
45
- | MRPC | ❌ | F1/Accuracy | 88.85/84.09 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
46
  | MRPC | βœ… | F1/Accuracy | 91.10/87.25 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/mrpc'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/MRPC-yellow'></a> |
47
- | QQP | ❌ | F1/Accuracy | 87.49/90.71 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
48
  | QQP | βœ… | F1/Accuracy | 89.72/90.88 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qqp'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QQP-yellow'></a> |
49
- | QNLI | ❌ | Accuracy | 90.66 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
50
  | QNLI | βœ… | Accuracy | 91.10 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qnli'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QNLI-yellow'></a> |
51
- | RTE | ❌ | Accuracy | 65.70 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> |
52
  | RTE | βœ… | Accuracy | 72.56 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/rte'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/RTE-yellow'></a> |
53
- | Q/A* | ❌ | F1/Extra match | 88.52/81.22 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-question_answering-yellow'></a> |
54
  | Q/A* | βœ… | F1/Extra match | 88.67/81.51 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qa'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QA-yellow'></a> |
55
- | AC† | ❌ | Accuracy | 98.26 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-audio_classification-yellow'></a> |
56
  | AC† | βœ… | Accuracy | 98.31 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/ac'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/AC-yellow'></a> |
57
 
 
 
 
58
  ## Requirements
59
 
60
  1. Install `torch>=2.0.0+cu118`.
@@ -90,11 +97,12 @@ We provide baseline models and SPG-trained models, all available for download at
90
 
91
  ## Training
92
 
93
- ### Model retraining
94
- We utilize recipes similar to those in [PyTorch Vision's classification reference](https://github.com/pytorch/vision/blob/main/references/classification/README.md) to retrain MobileNet-V2, ResNet, EfficientNet-V2, and ViT using our SPG on ImageNet. You can run the following command:
 
95
 
96
- ```train
97
- cd image-classification
98
 
99
  # MobileNet-V2
100
  torchrun --nproc_per_node=4 train.py\
@@ -129,10 +137,12 @@ torchrun --nproc_per_node=4 train.py\
129
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
130
  ```
131
 
132
- We utilize recipes similar to those in [PyTorch Vision's segmentation reference](https://github.com/pytorch/vision/blob/main/references/segmentation/README.md) to retrain FCN and DeepLab-V3 using our SPG on COCO dataset. You can run the following command:
 
133
 
134
- ```train
135
- cd semantic-segmentation
 
136
 
137
  # FCN-ResNet50
138
  torchrun --nproc_per_node=4 train.py\
@@ -166,100 +176,20 @@ torchrun --nproc_per_node=4 train.py\
166
  --lr-warmup-method constant --lr-warmup-epochs 3 --lr-warmup-decay 0. \
167
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
168
  ```
 
169
 
170
- ### Transfer learning
171
- We utilize recipes similar to those in [HuggingFace Transformers' Examples](https://github.com/huggingface/transformers/blob/main/examples/pytorch/README.md) to retrain BERT and Wav2Vec using our SPG on GLUE benchmark, SquAD dataset, and SUPERB benchmark. You can run the following command:
172
-
173
- ```train
174
- cd text-classification
175
-
176
- # Task: CoLA
177
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
178
- --model_name_or_path google-bert/bert-base-cased \
179
- --task_name "cola" \
180
- --do_train \
181
- --do_eval \
182
- --max_seq_length 128 \
183
- --per_device_train_batch_size 32 \
184
- --learning_rate 2.5e-5 \
185
- --num_train_epochs 6 \
186
- --output_dir "cola" \
187
- --overwrite_output_dir \
188
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
189
-
190
- # Task: SST-2
191
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
192
- --model_name_or_path google-bert/bert-base-cased \
193
- --task_name "sst2" \
194
- --do_train \
195
- --do_eval \
196
- --max_seq_length 128 \
197
- --per_device_train_batch_size 64 \
198
- --learning_rate 3e-5 \
199
- --num_train_epochs 5 \
200
- --output_dir "sst2" \
201
- --overwrite_output_dir \
202
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
203
-
204
- # Task: MRPC
205
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
206
- --model_name_or_path google-bert/bert-base-cased \
207
- --task_name "mrpc" \
208
- --do_train \
209
- --do_eval \
210
- --max_seq_length 128 \
211
- --per_device_train_batch_size 16 \
212
- --learning_rate 2e-5 \
213
- --num_train_epochs 4 \
214
- --output_dir "mrpc" \
215
- --overwrite_output_dir \
216
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
217
 
218
- # Task: QQP
219
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
220
- --model_name_or_path google-bert/bert-base-cased \
221
- --task_name "qqp" \
222
- --do_train \
223
- --do_eval \
224
- --max_seq_length 128 \
225
- --per_device_train_batch_size 32 \
226
- --learning_rate 1e-5 \
227
- --num_train_epochs 10 \
228
- --output_dir "qqp" \
229
- --overwrite_output_dir \
230
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
231
-
232
- # Task: QNLI
233
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
234
- --model_name_or_path google-bert/bert-base-cased \
235
- --task_name "qnli" \
236
- --do_train \
237
- --do_eval \
238
- --max_seq_length 128 \
239
- --per_device_train_batch_size 32 \
240
- --learning_rate 2e-5 \
241
- --num_train_epochs 10 \
242
- --output_dir "qnli" \
243
- --overwrite_output_dir \
244
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
245
 
246
- # Task: RTE
247
- CUDA_VISIBLE_DEVICES=0 python run_glue.py \
248
- --model_name_or_path google-bert/bert-base-cased \
249
- --task_name "rte" \
250
- --do_train \
251
- --do_eval \
252
- --max_seq_length 128 \
253
- --per_device_train_batch_size 32 \
254
- --learning_rate 5e-5 \
255
- --num_train_epochs 5 \
256
- --output_dir "rte" \
257
- --overwrite_output_dir \
258
- --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
259
-
260
 
261
- # Task: audio classification
262
- cd ../audio-classification
263
  CUDA_VISIBLE_DEVICES=0 python run_audio_classification.py \
264
  --model_name_or_path facebook/wav2vec2-base \
265
  --dataset_name superb \
@@ -290,10 +220,14 @@ CUDA_VISIBLE_DEVICES=0 python run_audio_classification.py \
290
  --seed 0 \
291
  --push_to_hub \
292
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
 
293
 
294
 
295
- # Task: question answering
296
- cd ../question-answering
 
 
 
297
  CUDA_VISIBLE_DEVICES=0 python run_qa.py \
298
  --model_name_or_path google-bert/bert-base-uncased \
299
  --dataset_name squad \
@@ -309,12 +243,13 @@ CUDA_VISIBLE_DEVICES=0 python run_qa.py \
309
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
310
  ```
311
 
312
- ### Network Architecture Search
313
- We conduct Neural Architecture Search (NAS) on the ResNet architecture using the ImageNet dataset. You can run the following command:
314
 
315
- ```train
316
- cd ../neural-architecture-search
317
 
 
318
  torchrun --nproc_per_node=4 train.py\
319
  --data-path /home/cs/Documents/datasets/imagenet\
320
  --model resnet18 --output-dir resnet18 --weights ResNet18_Weights.IMAGENET1K_V1\
@@ -322,7 +257,7 @@ torchrun --nproc_per_node=4 train.py\
322
  --lr-warmup-method constant --lr-warmup-epochs 1 --lr-warmup-decay 0.\
323
  --apply-trp --trp-depths 3 3 3 --trp-planes 256 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
324
 
325
- # βœ… Test: Acc@1 73.900 Acc@5 91.536
326
  torchrun --nproc_per_node=4 train.py\
327
  --data-path /home/cs/Documents/datasets/imagenet\
328
  --model resnet34 --output-dir resnet34 --weights ResNet34_Weights.IMAGENET1K_V1\
@@ -330,8 +265,7 @@ torchrun --nproc_per_node=4 train.py\
330
  --lr-warmup-method constant --lr-warmup-epochs 1 --lr-warmup-decay 0.\
331
  --apply-trp --trp-depths 2 2 2 --trp-planes 256 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
332
 
333
-
334
- # βœ… Test: Acc@1 76.896 Acc@5 93.136
335
  torchrun --nproc_per_node=4 train.py\
336
  --data-path /home/cs/Documents/datasets/imagenet\
337
  --model resnet50 --output-dir resnet50 --weights ResNet50_Weights.IMAGENET1K_V1\
@@ -344,7 +278,7 @@ torchrun --nproc_per_node=4 train.py\
344
 
345
  To evaluate our models on ImageNet, run:
346
 
347
- ```eval
348
 
349
  cd image-classification
350
 
@@ -372,9 +306,9 @@ torchrun --nproc_per_node=4 train.py\
372
 
373
  To evaluate our models on COCO, run:
374
 
375
- ```eval
376
 
377
- cd semantic-segmentation
378
 
379
  # eval baselines
380
  torchrun --nproc_per_node=4 train.py\
@@ -425,9 +359,9 @@ To evaluate our models on GLUE, SquAD, and SUPERB, please re-run the `transfer l
425
 
426
 
427
  For Network Architecture Search, please run the following command to evaluate our SPG-trained ResNet-18 model:
428
- ```eval
429
 
430
- cd neural-architecture-search
431
 
432
  # Required: Download our ResNet-18 weights to /path/to/neural-architecture-search/resnet18
433
  torchrun --nproc_per_node=4 train.py\
 
1
  # SPG: Sequential Policy Gradient for Adaptive Hyperparameter Optimization
2
 
3
 
4
+ ## Model Zoo: Adaptive Hyperparameter Optimization (HPO) via SPG Algorithm
 
5
 
6
 
7
+ `Table 1: Performance of pre-trained vs. SPG-retrained models on ImageNet-1K`
8
+ | Model | SPG | # Params | Acc@1 (%) | Acc@5 (%) | Weights | Command to reproduce |
9
+ |-------|------|----------|-----------|-----------|---------|----------------------|
10
+ | MobileNet-V2 | ❌ | 3.5 M | 71.878 | 90.286 | <a href='https://download.pytorch.org/models/mobilenet_v2-b0353104.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/classification#mobilenetv2'>Recipe</a> |
11
+ | MobileNet-V2 | βœ… | 3.5 M | 72.104 | 90.316 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/mobilenet_v2/model_32.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/mobilenet_v2-yellow'></a> | [examples/image-classification/run.sh](#-Retrain-model-on-ImageNet-1K) |
12
+ | ResNet-50 | ❌ | 25.6 M | 76.130 | 92.862 | <a href='https://download.pytorch.org/models/resnet50-0676ba61.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/classification#resnet'>Recipe</a> |
13
  | ResNet-50 | βœ… | 25.6 M | 77.234 | 93.322 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/resnet50/model_35.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/resnet50-yellow'></a> |
14
+ | EfficientNet-V2-M | ❌ | 54.1 M | 85.112 | 97.156 | <a href='https://download.pytorch.org/models/efficientnet_v2_m-dc08266a.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/classification#efficientnet-v2'>Recipe</a> |
15
  | EfficientNet-V2-M | βœ… | 54.1 M | 85.218 | 97.208 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/efficientnet_v2_m/model_7.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/efficientnet_v2_m-yellow'></a> |
16
+ | ViT-B16 | ❌ | 86.6 M | 81.072 | 95.318 | <a href='https://download.pytorch.org/models/vit_b_16-c867db91.pth'><img src='https://img.shields.io/badge/PyTorch-IMAGENET1K_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/classification#vit_b_16'>Recipe</a> |
17
  | ViT-B16 | βœ… | 86.6 M | 81.092 | 95.304 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/vit_b_16/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/vit_b_16-yellow'></a> |
18
 
19
 
 
 
20
 
21
+ `Table 2: Performance of pre-trained vs. SPG-retrained models. All models are evaluated a subset of COCO val2017, on the 21 categories (including "background") that are present in the Pascal VOC dataset.`
22
 
23
+ ⚠️`All model reported on TorchVision (with weight COCO_WITH_VOC_LABELS_V1) were benchmarked using only 20 categories. Researchers should first download the pre-trained model from TorchVision and conduct re-evaluation under the 21-category framework.`
24
+
25
+ | Model | SPG | # Params | mIoU (%) | pixelwise Acc (%) | Weights | Command to reproduce |
26
+ |---------------------|-----|----------|------------|---------------------|---------|----------------------|
27
+ | FCN-ResNet50 | ❌ | 35.3 M | 58.9 | 90.9 | <a href='https://download.pytorch.org/models/fcn_resnet50_coco-1167a1af.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/segmentation#fcn_resnet50'>Recipe</a> |
28
  | FCN-ResNet50 | βœ… | 35.3 M | 59.4 | 90.9 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/fcn_resnet50/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/fcn_resnet50-yellow'></a> |
29
+ | FCN-ResNet101 | ❌ | 54.3 M | 62.2 | 91.1 | <a href='https://download.pytorch.org/models/fcn_resnet101_coco-7ecb50ca.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/segmentation#deeplabv3_resnet101'>Recipe</a> |
30
  | FCN-ResNet101 | βœ… | 54.3 M | 62.4 | 91.1 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/fcn_resnet101/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/fcn_resnet101-yellow'></a> |
31
+ | DeepLabV3-ResNet50 | ❌ | 42.0 M | 63.8 | 91.5 | <a href='https://download.pytorch.org/models/deeplabv3_resnet50_coco-cd0a2569.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/segmentation#deeplabv3_resnet50'>Recipe</a> |
32
  | DeepLabV3-ResNet50 | βœ… | 42.0 M | 64.2 | 91.6 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/deeplabv3_resnet50/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/deeplabv3_resnet50-yellow'></a> |
33
+ | DeepLabV3-ResNet101 | ❌ | 61.0 M | 65.3 | 91.7 | <a href='https://download.pytorch.org/models/deeplabv3_resnet101_coco-586e9e4e.pth'><img src='https://img.shields.io/badge/PyTorch-COCO_WITH_VOC_LABELS_V1-FFA500?style=flat&logo=pytorch&logoColor=orange&labelColor=00000000'></a> | <a href='https://github.com/pytorch/vision/tree/main/references/segmentation#deeplabv3_resnet101'>Recipe</a> |
34
  | DeepLabV3-ResNet101 | βœ… | 61.0 M | 65.7 | 91.8 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/resolve/main/deeplabv3_resnet101/model_4.pth'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/deeplabv3_resnet101-yellow'></a> |
35
 
36
 
37
+
38
+ `Table X: Performance comparison of fine-tuned vs. SPG-retrained models across NLP and speech benchmarks.`
39
+ - GLUE (Text classification: BERT on CoLA, SST-2, MRPC, QQP, QNLI, and RTE task)
40
+ - SQuAD (Question answering: BERT)
41
+ - SUPERB (Speech classification: Wav2Vec2 for Audio Classification (AC))
42
+
43
+ | Task | SPG | Metric Type | Performance (%) | Weights | Command to reproduce |
44
+ |-------|------|-------------------|-----------------|---------|----------------------|
45
+ | CoLA | ❌ | Matthews coor | 56.53 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
46
  | CoLA | βœ… | Matthews coor | 62.13 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/cola'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/CoLA-yellow'></a> |
47
+ | SST-2 | ❌ | Accuracy | 92.32 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
48
  | SST-2 | βœ… | Accuracy | 92.54 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/sst2'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/SST2-yellow'></a> |
49
+ | MRPC | ❌ | F1/Accuracy | 88.85/84.09 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
50
  | MRPC | βœ… | F1/Accuracy | 91.10/87.25 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/mrpc'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/MRPC-yellow'></a> |
51
+ | QQP | ❌ | F1/Accuracy | 87.49/90.71 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
52
  | QQP | βœ… | F1/Accuracy | 89.72/90.88 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qqp'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QQP-yellow'></a> |
53
+ | QNLI | ❌ | Accuracy | 90.66 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
54
  | QNLI | βœ… | Accuracy | 91.10 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qnli'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QNLI-yellow'></a> |
55
+ | RTE | ❌ | Accuracy | 65.70 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-text_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification#glue-tasks'>Recipe</a> |
56
  | RTE | βœ… | Accuracy | 72.56 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/rte'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/RTE-yellow'></a> |
57
+ | Q/A* | ❌ | F1/Extra match | 88.52/81.22 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-question_answering-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering#fine-tuning-bert-on-squad10'>Recipe</a> |
58
  | Q/A* | βœ… | F1/Extra match | 88.67/81.51 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/qa'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/QA-yellow'></a> |
59
+ | AC† | ❌ | Accuracy | 98.26 | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-audio_classification-yellow'></a> | <a href='https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification#single-gpu'>Recipe</a> |
60
  | AC† | βœ… | Accuracy | 98.31 | <a href='https://huggingface.co/UniversalAlgorithmic/SPG/tree/main/ac'><img src='https://img.shields.io/badge/%F0%9F%A4%97%20Huggingface-SPG/AC-yellow'></a> |
61
 
62
+
63
+ ## Model Zoo: Neural Architecture Search (NAS) via SPG Algorithm
64
+
65
  ## Requirements
66
 
67
  1. Install `torch>=2.0.0+cu118`.
 
97
 
98
  ## Training
99
 
100
+ <a id="#-Retrain-model-on-ImageNet-1K"></a>
101
+ ### Retrain model on ImageNet-1K
102
+ We use training recipes similar to those in [PyTorch Vision's classification reference](https://github.com/pytorch/vision/blob/main/references/classification/README.md) to retrain MobileNet-V2, ResNet, EfficientNet-V2, and ViT with our SPG on ImageNet-1K. The following command can be used:
103
 
104
+ ```bash
105
+ cd ./examples/image-classification
106
 
107
  # MobileNet-V2
108
  torchrun --nproc_per_node=4 train.py\
 
137
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
138
  ```
139
 
140
+ ### Retrain model on MS-COCO 2017
141
+ We use training recipes similar to those in [PyTorch Vision's segmentation reference](https://github.com/pytorch/vision/blob/main/references/segmentation/README.md) to retrain FCN and DeepLab-V3 with our SPG on COCO dataset. The following command can be used:
142
 
143
+ ```bash
144
+
145
+ cd ./examples/semantic-segmentation
146
 
147
  # FCN-ResNet50
148
  torchrun --nproc_per_node=4 train.py\
 
176
  --lr-warmup-method constant --lr-warmup-epochs 3 --lr-warmup-decay 0. \
177
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
178
  ```
179
+ </details>
180
 
181
+ ### Transfer learning on GLUE
182
+ We use recipes similar to those in [HuggingFace Transformers' Examples](https://github.com/huggingface/transformers/blob/main/examples/pytorch/README.md) to retrain BERT with our SPG on GLUE benchmark. The following command can be used:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
 
184
+ ```bash
185
+ cd ./examples/text-classification && bash run.sh
186
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
+ ### Transfer learning on SQuAD
189
+ We use recipes similar to those in [HuggingFace Transformers' Examples](https://github.com/huggingface/transformers/blob/main/examples/pytorch/README.md) to retrain Wav2Vec with our SPG on SQuAD dataset. The following command can be used:
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
+ ```bash
192
+ cd ./examples/audio-classification
193
  CUDA_VISIBLE_DEVICES=0 python run_audio_classification.py \
194
  --model_name_or_path facebook/wav2vec2-base \
195
  --dataset_name superb \
 
220
  --seed 0 \
221
  --push_to_hub \
222
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
223
+ ```
224
 
225
 
226
+ ### Transfer learning on SUPERB
227
+ We use recipes similar to those in [HuggingFace Transformers' Examples](https://github.com/huggingface/transformers/blob/main/examples/pytorch/README.md) to retrain BERT with our SPG on SUPERB benchmark. The following command can be used:
228
+
229
+ ```bash
230
+ cd ./examples/question-answering
231
  CUDA_VISIBLE_DEVICES=0 python run_qa.py \
232
  --model_name_or_path google-bert/bert-base-uncased \
233
  --dataset_name squad \
 
243
  --apply-trp --trp-depths 1 --trp-p 0.1 --trp-lambdas 0.4 0.2 0.1
244
  ```
245
 
246
+ ### Neural Architecture Search for ResNet on ImageNet-1K
247
+ We conduct Neural Architecture Search (NAS) for the ResNet architecture on the ImageNet dataset. The following command can be used:
248
 
249
+ ```bash
250
+ cd ./examples/neural-architecture-search
251
 
252
+ # During Neural Architecture Search (NAS), we explore ResNet-18, ResNet-27, ResNet-36, and ResNet-45. After retraining with SPG algorithm, we retain only ResNet-18 and discard the others.
253
  torchrun --nproc_per_node=4 train.py\
254
  --data-path /home/cs/Documents/datasets/imagenet\
255
  --model resnet18 --output-dir resnet18 --weights ResNet18_Weights.IMAGENET1K_V1\
 
257
  --lr-warmup-method constant --lr-warmup-epochs 1 --lr-warmup-decay 0.\
258
  --apply-trp --trp-depths 3 3 3 --trp-planes 256 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
259
 
260
+ # During Neural Architecture Search (NAS), we explore ResNet-34, ResNet-40, ResNet-46, and ResNet-52. After retraining with SPG algorithm, we retain only ResNet-34 and discard the others.
261
  torchrun --nproc_per_node=4 train.py\
262
  --data-path /home/cs/Documents/datasets/imagenet\
263
  --model resnet34 --output-dir resnet34 --weights ResNet34_Weights.IMAGENET1K_V1\
 
265
  --lr-warmup-method constant --lr-warmup-epochs 1 --lr-warmup-decay 0.\
266
  --apply-trp --trp-depths 2 2 2 --trp-planes 256 --trp-lambdas 0.4 0.2 0.1 --print-freq 100
267
 
268
+ # During Neural Architecture Search (NAS), we explore ResNet-34, ResNet-50, ResNet-53, and ResNet-56. After retraining with SPG algorithm, we retain only ResNet-50 and discard the others.
 
269
  torchrun --nproc_per_node=4 train.py\
270
  --data-path /home/cs/Documents/datasets/imagenet\
271
  --model resnet50 --output-dir resnet50 --weights ResNet50_Weights.IMAGENET1K_V1\
 
278
 
279
  To evaluate our models on ImageNet, run:
280
 
281
+ ```bash
282
 
283
  cd image-classification
284
 
 
306
 
307
  To evaluate our models on COCO, run:
308
 
309
+ ```bash
310
 
311
+ cd ./examples/semantic-segmentation
312
 
313
  # eval baselines
314
  torchrun --nproc_per_node=4 train.py\
 
359
 
360
 
361
  For Network Architecture Search, please run the following command to evaluate our SPG-trained ResNet-18 model:
362
+ ```bash
363
 
364
+ cd ./examples/neural-architecture-search
365
 
366
  # Required: Download our ResNet-18 weights to /path/to/neural-architecture-search/resnet18
367
  torchrun --nproc_per_node=4 train.py\