File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change 29
29
"detectron2_fcos_r_50_fpn" ,
30
30
}
31
31
32
+ # torchbench models that might OOM using Adam.
33
+ # This list was extracted from PyTorch's repository: benchmarks/dynamo/common.py
34
+ TRAIN_WITH_SGD = {
35
+ "BERT_pytorch" ,
36
+ "LearningToPaint" ,
37
+ "alexnet" ,
38
+ "dcgan" ,
39
+ "demucs" ,
40
+ "densenet121" ,
41
+ "dlrm" ,
42
+ "fastNLP_Bert" ,
43
+ "mobilenet_v2" ,
44
+ "phlippe_densenet" ,
45
+ "phlippe_resnet" ,
46
+ "pytorch_stargan" ,
47
+ "resnet18" ,
48
+ "shufflenet_v2_x1_0" ,
49
+ "speech_transformer" ,
50
+ "squeezenet1_1" ,
51
+ "stable_diffusion_text_encoder" ,
52
+ "timm_efficientdet" ,
53
+ "timm_nfnet" ,
54
+ "timm_regnet" ,
55
+ "timm_vision_transformer" ,
56
+ "timm_vovnet" ,
57
+ "vgg16" ,
58
+ "hf_T5" ,
59
+ }
60
+
32
61
# Skip the experiment of a model if any of the experiment configs in the list is fully matched
33
62
DENY_LIST = {
34
63
"doctr_det_predictor" : [{
@@ -179,7 +208,10 @@ def set_up(self):
179
208
180
209
This is model suite specific.
181
210
"""
182
- self .optimizer_class = torch .optim .Adam
211
+ if self .benchmark_experiment .test == "train" and self .model_name in TRAIN_WITH_SGD :
212
+ self .optimizer_class = torch .optim .SGD
213
+ else :
214
+ self .optimizer_class = torch .optim .Adam
183
215
184
216
benchmark = self .load_benchmark ()
185
217
@@ -205,8 +237,6 @@ def set_up(self):
205
237
if self .model_name == "yolov3" :
206
238
self .example_inputs = (torch .rand (self .benchmark_experiment .batch_size , 3 ,
207
239
384 , 512 ),)
208
- if self .benchmark_experiment .test == "train" and self .model_name in DETECTRON2_MODELS :
209
- self .optimizer = benchmark .optimizer
210
240
211
241
del benchmark
212
242
self ._cleanup ()
You can’t perform that action at this time.
0 commit comments