Skip to content

Commit

Permalink
Remove multiprocessing_distributed from the configs (#1358)
Browse files Browse the repository at this point in the history
### Changes
As stated in the title.

### Reason for changes
This config construction conflicts with setting a `--gpu-id N` option
via CLI, and there's no way to "disable" the multiprocessing option if
it is already specified in the sample config.

### Related tickets
N/A

### Tests
TBR
  • Loading branch information
vshampor authored Nov 14, 2022
1 parent f1df738 commit 85c3f78
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"num_classes": 1000,
"batch_size" : 144,
"epochs": 5,
"multiprocessing_distributed" : true,

"optimizer": {
"type": "Adam",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"num_classes": 1000,
"batch_size" : 32,
"epochs": 1,
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"base_lr": 1e-5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"num_classes": 1000,
"batch_size" : 256,
"epochs": 40,
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"base_lr": 0.001,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
},

"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
},

"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
},

"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},

"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},

"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"sample_size": [1, 3, 368, 480]
},
"weighing": "mfb",
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"weighing": [0.0000, 0.0554, 0.3358, 0.0843, 0.7865, 0.7753, 1.1966, 5.1031, 2.4255,
0.0679, 0.8589, 0.0389, 2.8977, 9.4937, 0.2531, 1.8852, 2.1179, 2.1978,
5.9516, 6.4394],
"multiprocessing_distributed" : true,
"optimizer": {
"type": "SGD",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"weighing": [0.0000, 0.0554, 0.3358, 0.0843, 0.7865, 0.7753, 1.1966, 5.1031, 2.4255,
0.0679, 0.8589, 0.0389, 2.8977, 9.4937, 0.2531, 1.8852, 2.1179, 2.1978,
5.9516, 6.4394],
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"optimizer_params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
0.0679, 0.8589, 0.0389, 2.8977, 9.4937, 0.2531, 1.8852, 2.1179, 2.1978,
5.9516, 6.4394],
"batch_size" : 5,
"multiprocessing_distributed" : true,
"optimizer": {
"type": "Adam",
"optimizer_params": {
Expand Down
39 changes: 26 additions & 13 deletions tests/torch/sota_checkpoints_eval.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"config": "examples/torch/classification/configs/quantization/inception_v3_imagenet.json",
"target": 77.34,
"metric_type": "Acc@1",
"model_description": "Inception V3"
"model_description": "Inception V3",
"multiprocessing_distributed": true
},
"inception_v3_imagenet_int8": {
"config": "examples/torch/classification/configs/quantization/inception_v3_imagenet_int8.json",
Expand All @@ -88,7 +89,8 @@
"model_description": "Inception V3",
"compression_description": "INT8",
"diff_fp32_min": -1,
"diff_fp32_max": 1.0
"diff_fp32_max": 1.0,
"multiprocessing_distributed": true
},
"inception_v3_imagenet_rb_sparsity_int8": {
"config": "examples/torch/classification/configs/sparsity_quantization/inception_v3_imagenet_rb_sparsity_int8.json",
Expand All @@ -99,7 +101,8 @@
"model_description": "Inception V3",
"compression_description": "INT8 + Sparsity 61% (RB)",
"diff_fp32_min": -1,
"diff_fp32_max": 0.4
"diff_fp32_max": 0.4,
"multiprocessing_distributed": true
},
"mobilenet_v2_imagenet": {
"config": "examples/torch/classification/configs/quantization/mobilenet_v2_imagenet.json",
Expand Down Expand Up @@ -394,7 +397,8 @@
"resume": "unet_camvid.pth",
"mean_value": "[99.603,103.329,105.6567]",
"scale_value": "[75.643,77.821,76.746]",
"model_description": "UNet"
"model_description": "UNet",
"multiprocessing_distributed": true
},
"unet_camvid_int8": {
"config": "examples/torch/semantic_segmentation/configs/unet_camvid_int8.json",
Expand All @@ -408,7 +412,8 @@
"scale_value": "[75.643,77.821,76.746]",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1,
"diff_target_min": -0.2
"diff_target_min": -0.2,
"multiprocessing_distributed": true
},
"unet_camvid_magnitude_sparsity_int8": {
"config": "examples/torch/semantic_segmentation/configs/unet_camvid_magnitude_sparsity_int8.json",
Expand All @@ -421,7 +426,8 @@
"model_description": "UNet",
"compression_description": "INT8 + Sparsity 60% (Magnitude)",
"diff_fp32_min": -1,
"diff_fp32_max": 0.6
"diff_fp32_max": 0.6,
"multiprocessing_distributed": true
},
"icnet_camvid": {
"config": "examples/torch/semantic_segmentation/configs/icnet_camvid.json",
Expand All @@ -430,7 +436,8 @@
"resume": "icnet_camvid.pth",
"mean_value": "[99.603,103.329,105.6567]",
"scale_value": "[75.643,77.821,76.746]",
"model_description": "ICNet"
"model_description": "ICNet",
"multiprocessing_distributed": true
},
"icnet_camvid_int8": {
"config": "examples/torch/semantic_segmentation/configs/icnet_camvid_int8.json",
Expand All @@ -443,7 +450,8 @@
"model_description": "ICNet",
"compression_description": "INT8",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1
"diff_fp32_max": 0.1,
"multiprocessing_distributed": true
},
"icnet_camvid_magnitude_sparsity_int8": {
"config": "examples/torch/semantic_segmentation/configs/icnet_camvid_magnitude_sparsity_int8.json",
Expand All @@ -456,7 +464,8 @@
"model_description": "ICNet",
"compression_description": "INT8 + Sparsity 60% (Magnitude)",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1
"diff_fp32_max": 0.1,
"multiprocessing_distributed": true
}
},
"mapillary_vistas": {
Expand All @@ -465,7 +474,8 @@
"target": 56.23,
"metric_type": "Mean IoU",
"resume": "unet_mapillary.pth",
"model_description": "UNet"
"model_description": "UNet",
"multiprocessing_distributed": true
},
"unet_mapillary_int8": {
"config": "examples/torch/semantic_segmentation/configs/unet_mapillary_int8.json",
Expand All @@ -476,7 +486,8 @@
"model_description": "UNet",
"compression_description": "INT8",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1
"diff_fp32_max": 0.1,
"multiprocessing_distributed": true
},
"unet_mapillary_magnitude_sparsity_int8": {
"config": "examples/torch/semantic_segmentation/configs/unet_mapillary_magnitude_sparsity_int8.json",
Expand All @@ -488,7 +499,8 @@
"compression_description": "INT8 + Sparsity 60% (Magnitude)",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1,
"diff_target_max": 0.2
"diff_target_max": 0.2,
"multiprocessing_distributed": true
},
"unet_mapillary_pruning_geometric_median": {
"config": "examples/torch/semantic_segmentation/configs/unet_mapillary_pruning_geometric_median.json",
Expand All @@ -499,7 +511,8 @@
"model_description": "UNet",
"compression_description": "Filter pruning, 25%, geometric median criterion",
"diff_fp32_min": -1,
"diff_fp32_max": 0.1
"diff_fp32_max": 0.1,
"multiprocessing_distributed": true
}
}
}
Expand Down
19 changes: 13 additions & 6 deletions tests/torch/test_sota_checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def __init__(self,
diff_fp32_max_: float,
model_name_: str,
diff_target_min_: float,
diff_target_max_: float
diff_target_max_: float,
multiprocessing_distributed: bool
):
self.config_name_ = config_name_
self.reference_ = reference_
Expand All @@ -64,6 +65,7 @@ def __init__(self,
self.model_name_ = model_name_
self.diff_target_min_ = diff_target_min_
self.diff_target_max_ = diff_target_max_
self.multiprocessing_distributed = multiprocessing_distributed


class TestSotaCheckpoints:
Expand Down Expand Up @@ -313,10 +315,12 @@ def read_metric(metric_file_name: str):
scale_val = model_dict[model_name].get('scale_value', {})
else:
scale_val = '[58.4795,57.1429,57.4713]'
diff_fp32_min = model_dict[model_name].get('diff_fp32_min') if not None else None
diff_fp32_max = model_dict[model_name].get('diff_fp32_max') if not None else None
diff_target_min = model_dict[model_name].get('diff_target_min') if not None else None
diff_target_max = model_dict[model_name].get('diff_target_max') if not None else None
diff_fp32_min = model_dict[model_name].get('diff_fp32_min')
diff_fp32_max = model_dict[model_name].get('diff_fp32_max')
diff_target_min = model_dict[model_name].get('diff_target_min')
diff_target_max = model_dict[model_name].get('diff_target_max')
multiprocessing_distributed = model_dict[model_name].get('multiprocessing_distributed', False)

param_list.append(EvalRunParamsStruct(config_name,
reference,
expected,
Expand All @@ -331,7 +335,8 @@ def read_metric(metric_file_name: str):
diff_fp32_max,
model_name,
diff_target_min,
diff_target_max))
diff_target_max,
multiprocessing_distributed))
ids_list.append(model_name)
if model_dict[model_name].get('compression_description', {}):
train_param_list.append((config_name,
Expand Down Expand Up @@ -364,6 +369,8 @@ def test_eval(self, sota_checkpoints_dir, sota_data_dir, eval_test_struct: EvalR
cmd += " --pretrained"
if eval_test_struct.batch_:
cmd += " -b {}".format(eval_test_struct.batch_)
if eval_test_struct.multiprocessing_distributed:
cmd += " --multiprocessing-distributed"
exit_code, err_str = self.run_cmd(cmd, cwd=PROJECT_ROOT)

is_ok = (exit_code == 0 and metrics_dump_file_path.exists())
Expand Down

0 comments on commit 85c3f78

Please sign in to comment.