From d421f49e60e9e36d05c6de8e4af51d30e3836c61 Mon Sep 17 00:00:00 2001 From: zhaoting Date: Tue, 15 Sep 2020 16:52:26 +0800 Subject: [PATCH] delete redundant codes --- model_zoo/official/cv/alexnet/README.md | 2 +- .../official/cv/deeplabv3/src/data/data_generator.py | 2 +- .../src/FasterRcnn/bbox_assign_sample_stage2.py | 2 +- model_zoo/official/cv/googlenet/train.py | 3 --- model_zoo/official/cv/inceptionv3/README.md | 2 +- model_zoo/official/cv/lenet/README.md | 2 +- model_zoo/official/cv/lenet/src/lenet.py | 4 ++-- model_zoo/official/cv/lenet_quant/src/lenet_fusion.py | 2 +- model_zoo/official/cv/lenet_quant/src/lenet_quant.py | 2 +- .../cv/maskrcnn/src/maskrcnn/bbox_assign_sample_stage2.py | 2 +- model_zoo/official/cv/mobilenetv2/README.md | 2 +- model_zoo/official/cv/mobilenetv2/src/mobilenetV2.py | 8 +++++--- model_zoo/official/cv/mobilenetv2/src/models.py | 4 ++-- model_zoo/official/cv/mobilenetv2_quant/src/utils.py | 4 ++-- model_zoo/official/cv/mobilenetv3/Readme.md | 2 +- model_zoo/official/cv/mobilenetv3/src/mobilenetV3.py | 4 ++-- model_zoo/official/cv/mobilenetv3/train.py | 4 ++-- model_zoo/official/cv/nasnet/src/dataset.py | 1 - model_zoo/official/cv/resnet_thor/src/dataset_helper.py | 4 ++-- model_zoo/official/cv/resnet_thor/src/resnet_thor.py | 2 +- model_zoo/official/cv/resnext50/README.md | 2 +- .../official/cv/resnext50/src/utils/optimizers__init__.py | 3 --- model_zoo/official/cv/shufflenetv2/Readme.md | 2 +- model_zoo/official/cv/shufflenetv2/src/dataset.py | 1 - model_zoo/official/cv/shufflenetv2/src/shufflenetv2.py | 1 - model_zoo/official/cv/ssd/src/dataset.py | 1 - model_zoo/official/cv/vgg16/train.py | 1 - model_zoo/official/cv/yolov3_darknet53/src/transforms.py | 2 +- .../official/cv/yolov3_darknet53_quant/src/transforms.py | 2 +- model_zoo/official/cv/yolov3_resnet18/src/dataset.py | 1 - model_zoo/official/nlp/bert/pretrain_eval.py | 2 +- model_zoo/official/nlp/bert/src/bert_model.py | 4 ++-- model_zoo/official/nlp/bert/src/utils.py | 1 - model_zoo/official/nlp/bert_thor/README.md | 2 +- model_zoo/official/nlp/bert_thor/pretrain_eval.py | 2 +- model_zoo/official/nlp/bert_thor/src/bert_model.py | 4 ++-- model_zoo/official/nlp/bert_thor/src/dataset_helper.py | 2 +- model_zoo/official/nlp/bert_thor/src/thor_for_bert.py | 4 ++-- model_zoo/official/nlp/bert_thor/src/thor_for_bert_arg.py | 4 ++-- model_zoo/official/nlp/bert_thor/src/utils.py | 1 - model_zoo/official/nlp/lstm/eval.py | 1 - model_zoo/official/nlp/lstm/src/imdb.py | 4 ++-- model_zoo/official/nlp/lstm/train.py | 1 - model_zoo/official/nlp/mass/README.md | 2 +- .../official/nlp/mass/src/transformer/beam_search.py | 3 +-- model_zoo/official/nlp/tinybert/src/tinybert_for_gd_td.py | 2 -- model_zoo/official/nlp/tinybert/src/tinybert_model.py | 4 ++-- model_zoo/official/nlp/transformer/src/beam_search.py | 2 +- .../official/nlp/transformer/src/transformer_for_train.py | 2 +- .../wide_and_deep_multitable/src/wide_and_deep.py | 1 + model_zoo/research/cv/ghostnet/Readme.md | 2 +- model_zoo/research/cv/ghostnet/src/ghostnet600.py | 1 - model_zoo/research/cv/ghostnet_quant/Readme.md | 2 +- model_zoo/research/cv/ghostnet_quant/src/ghostnet.py | 2 +- model_zoo/research/cv/resnet50_adv_pruning/Readme.md | 2 +- model_zoo/research/cv/ssd_ghostnet/README.md | 2 +- model_zoo/research/cv/ssd_ghostnet/src/ssd_ghostnet.py | 8 -------- model_zoo/research/cv/ssd_ghostnet/train.py | 3 --- model_zoo/utils/graph_to_mindrecord/writer.py | 1 - .../wide_and_deep/python_file_for_ci/wide_and_deep.py | 7 +------ tests/st/networks/models/bert/src/fused_layer_norm.py | 3 +-- tests/st/networks/models/deeplabv3/src/md_dataset.py | 2 +- 62 files changed, 61 insertions(+), 96 deletions(-) diff --git a/model_zoo/official/cv/alexnet/README.md b/model_zoo/official/cv/alexnet/README.md index 84ec3c1d26..d63dfa4b2f 100644 --- a/model_zoo/official/cv/alexnet/README.md +++ b/model_zoo/official/cv/alexnet/README.md @@ -50,7 +50,7 @@ Dataset used: [CIFAR-10]() - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/deeplabv3/src/data/data_generator.py b/model_zoo/official/cv/deeplabv3/src/data/data_generator.py index 4cbcafa425..31e5cd9384 100644 --- a/model_zoo/official/cv/deeplabv3/src/data/data_generator.py +++ b/model_zoo/official/cv/deeplabv3/src/data/data_generator.py @@ -13,8 +13,8 @@ # limitations under the License. # ============================================================================ -import cv2 import numpy as np +import cv2 import mindspore.dataset as de cv2.setNumThreads(0) diff --git a/model_zoo/official/cv/faster_rcnn/src/FasterRcnn/bbox_assign_sample_stage2.py b/model_zoo/official/cv/faster_rcnn/src/FasterRcnn/bbox_assign_sample_stage2.py index 31e3870c18..2eb9902c2a 100644 --- a/model_zoo/official/cv/faster_rcnn/src/FasterRcnn/bbox_assign_sample_stage2.py +++ b/model_zoo/official/cv/faster_rcnn/src/FasterRcnn/bbox_assign_sample_stage2.py @@ -114,7 +114,7 @@ class BboxAssignSampleForRcnn(nn.Cell): bboxes = self.select(self.cast(self.tile(self.reshape(self.cast(valid_mask, mstype.int32), \ (self.num_bboxes, 1)), (1, 4)), mstype.bool_), \ bboxes, self.check_anchor_two) - # 1 dim = gt, 2 dim = bbox + overlaps = self.iou(bboxes, gt_bboxes_i) max_overlaps_w_gt_index, max_overlaps_w_gt = self.max_gt(overlaps) diff --git a/model_zoo/official/cv/googlenet/train.py b/model_zoo/official/cv/googlenet/train.py index c887b1b9ce..cee5a8693d 100644 --- a/model_zoo/official/cv/googlenet/train.py +++ b/model_zoo/official/cv/googlenet/train.py @@ -166,15 +166,12 @@ if __name__ == '__main__': parameter_name = x.name if parameter_name.endswith('.bias'): # all bias not using weight decay - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) elif parameter_name.endswith('.gamma'): # bn weight bias not using weight decay, be carefully for now x not include BN - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) elif parameter_name.endswith('.beta'): # bn weight bias not using weight decay, be carefully for now x not include BN - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) else: decay_params.append(x) diff --git a/model_zoo/official/cv/inceptionv3/README.md b/model_zoo/official/cv/inceptionv3/README.md index 1c3e99cdb1..aa07fc9d1e 100644 --- a/model_zoo/official/cv/inceptionv3/README.md +++ b/model_zoo/official/cv/inceptionv3/README.md @@ -54,7 +54,7 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend , please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/lenet/README.md b/model_zoo/official/cv/lenet/README.md index 2f0b00229e..16e1a8a06c 100644 --- a/model_zoo/official/cv/lenet/README.md +++ b/model_zoo/official/cv/lenet/README.md @@ -56,7 +56,7 @@ Dataset used: [MNIST]() - Hardware(Ascend/GPU/CPU) - Prepare hardware environment with Ascend, GPU, or CPU processor. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/lenet/src/lenet.py b/model_zoo/official/cv/lenet/src/lenet.py index dd46d98198..8bec0ae5f9 100644 --- a/model_zoo/official/cv/lenet/src/lenet.py +++ b/model_zoo/official/cv/lenet/src/lenet.py @@ -22,8 +22,8 @@ class LeNet5(nn.Cell): Lenet network Args: - num_class (int): Num classes. Default: 10. - num_channel (int): Num channels. Default: 1. + num_class (int): Number of classes. Default: 10. + num_channel (int): Number of channels. Default: 1. Returns: Tensor, output tensor diff --git a/model_zoo/official/cv/lenet_quant/src/lenet_fusion.py b/model_zoo/official/cv/lenet_quant/src/lenet_fusion.py index 88b3593502..4b30ac5a4e 100644 --- a/model_zoo/official/cv/lenet_quant/src/lenet_fusion.py +++ b/model_zoo/official/cv/lenet_quant/src/lenet_fusion.py @@ -21,7 +21,7 @@ class LeNet5(nn.Cell): Lenet network Args: - num_class (int): Num classes. Default: 10. + num_class (int): Number of classes. Default: 10. Returns: Tensor, output tensor diff --git a/model_zoo/official/cv/lenet_quant/src/lenet_quant.py b/model_zoo/official/cv/lenet_quant/src/lenet_quant.py index 12be3f28fa..d4e036f55e 100644 --- a/model_zoo/official/cv/lenet_quant/src/lenet_quant.py +++ b/model_zoo/official/cv/lenet_quant/src/lenet_quant.py @@ -22,7 +22,7 @@ class LeNet5(nn.Cell): Lenet network Args: - num_class (int): Num classes. Default: 10. + num_class (int): Number of classes. Default: 10. Returns: Tensor, output tensor diff --git a/model_zoo/official/cv/maskrcnn/src/maskrcnn/bbox_assign_sample_stage2.py b/model_zoo/official/cv/maskrcnn/src/maskrcnn/bbox_assign_sample_stage2.py index b9230d8453..b7678f624e 100644 --- a/model_zoo/official/cv/maskrcnn/src/maskrcnn/bbox_assign_sample_stage2.py +++ b/model_zoo/official/cv/maskrcnn/src/maskrcnn/bbox_assign_sample_stage2.py @@ -118,7 +118,7 @@ class BboxAssignSampleForRcnn(nn.Cell): bboxes = self.select(self.cast(self.tile(self.reshape(self.cast(valid_mask, mstype.int32), \ (self.num_bboxes, 1)), (1, 4)), mstype.bool_), \ bboxes, self.check_anchor_two) - # 1 dim = gt, 2 dim = bbox + overlaps = self.iou(bboxes, gt_bboxes_i) max_overlaps_w_gt_index, max_overlaps_w_gt = self.max_gt(overlaps) diff --git a/model_zoo/official/cv/mobilenetv2/README.md b/model_zoo/official/cv/mobilenetv2/README.md index eef7e7296a..c6efa83754 100644 --- a/model_zoo/official/cv/mobilenetv2/README.md +++ b/model_zoo/official/cv/mobilenetv2/README.md @@ -51,7 +51,7 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil - Hardware(Ascend/GPU/CPU) - Prepare hardware environment with Ascend、GPU or CPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/mobilenetv2/src/mobilenetV2.py b/model_zoo/official/cv/mobilenetv2/src/mobilenetV2.py index 02d823078d..8718679c55 100644 --- a/model_zoo/official/cv/mobilenetv2/src/mobilenetV2.py +++ b/model_zoo/official/cv/mobilenetv2/src/mobilenetV2.py @@ -145,7 +145,7 @@ class MobileNetV2Backbone(nn.Cell): MobileNetV2 architecture. Args: - class_num (Cell): number of classes. + class_num (int): number of classes. width_mult (int): Channels multiplier for round to 8/16 and others. Default is 1. has_dropout (bool): Is dropout used. Default is false inverted_residual_setting (list): Inverted residual settings. Default is None @@ -233,7 +233,7 @@ class MobileNetV2Head(nn.Cell): MobileNetV2 architecture. Args: - class_num (Cell): number of classes. + class_num (int): Number of classes. Default is 1000. has_dropout (bool): Is dropout used. Default is false Returns: Tensor, output tensor. @@ -284,11 +284,13 @@ class MobileNetV2(nn.Cell): MobileNetV2 architecture. Args: - class_num (Cell): number of classes. + class_num (int): number of classes. width_mult (int): Channels multiplier for round to 8/16 and others. Default is 1. has_dropout (bool): Is dropout used. Default is false inverted_residual_setting (list): Inverted residual settings. Default is None round_nearest (list): Channel round to . Default is 8 + backbone(nn.Cell): Backbone of MobileNetV2. + head(nn.Cell): Classification head of MobileNetV2. Returns: Tensor, output tensor. diff --git a/model_zoo/official/cv/mobilenetv2/src/models.py b/model_zoo/official/cv/mobilenetv2/src/models.py index 5eb799e316..183fcfa70b 100644 --- a/model_zoo/official/cv/mobilenetv2/src/models.py +++ b/model_zoo/official/cv/mobilenetv2/src/models.py @@ -29,8 +29,8 @@ class CrossEntropyWithLabelSmooth(_Loss): CrossEntropyWith LabelSmooth. Args: - smooth_factor (float): smooth factor, default=0. - num_classes (int): num classes + smooth_factor (float): smooth factor. Default is 0. + num_classes (int): number of classes. Default is 1000. Returns: None. diff --git a/model_zoo/official/cv/mobilenetv2_quant/src/utils.py b/model_zoo/official/cv/mobilenetv2_quant/src/utils.py index 9a6cb7d031..32dfa20fc1 100644 --- a/model_zoo/official/cv/mobilenetv2_quant/src/utils.py +++ b/model_zoo/official/cv/mobilenetv2_quant/src/utils.py @@ -83,8 +83,8 @@ class CrossEntropyWithLabelSmooth(_Loss): CrossEntropyWith LabelSmooth. Args: - smooth_factor (float): smooth factor, default=0. - num_classes (int): num classes + smooth_factor (float): smooth factor for label smooth. Default is 0. + num_classes (int): number of classes. Default is 1000. Returns: None. diff --git a/model_zoo/official/cv/mobilenetv3/Readme.md b/model_zoo/official/cv/mobilenetv3/Readme.md index 82be0aeba8..fa3099bd0c 100644 --- a/model_zoo/official/cv/mobilenetv3/Readme.md +++ b/model_zoo/official/cv/mobilenetv3/Readme.md @@ -45,7 +45,7 @@ Dataset used: [imagenet](http://www.image-net.org/) - Hardware(GPU) - Prepare hardware environment with GPU processor. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/mobilenetv3/src/mobilenetV3.py b/model_zoo/official/cv/mobilenetv3/src/mobilenetV3.py index 4ff4e6f894..069efa514a 100644 --- a/model_zoo/official/cv/mobilenetv3/src/mobilenetV3.py +++ b/model_zoo/official/cv/mobilenetv3/src/mobilenetV3.py @@ -83,7 +83,7 @@ class SE(nn.Cell): SE warpper definition. Args: - num_out (int): Output channel. + num_out (int): Numbers of output channels. ratio (int): middle output ratio. Returns: @@ -301,7 +301,7 @@ class MobileNetV3(nn.Cell): def _make_layer(self, kernel_size, exp_ch, out_channel, use_se, act_func, stride=1): mid_planes = exp_ch out_planes = out_channel - #num_in, num_mid, num_out, kernel_size, stride=1, act_type='relu', use_se=False): + layer = ResUnit(self.inplanes, mid_planes, out_planes, kernel_size, stride=stride, act_type=act_func, use_se=use_se) self.inplanes = out_planes diff --git a/model_zoo/official/cv/mobilenetv3/train.py b/model_zoo/official/cv/mobilenetv3/train.py index 429e820340..1e351088b3 100644 --- a/model_zoo/official/cv/mobilenetv3/train.py +++ b/model_zoo/official/cv/mobilenetv3/train.py @@ -68,8 +68,8 @@ class CrossEntropyWithLabelSmooth(_Loss): CrossEntropyWith LabelSmooth. Args: - smooth_factor (float): smooth factor, default=0. - num_classes (int): num classes + smooth_factor (float): smooth factor for label smooth. Default is 0. + num_classes (int): number of classes. Default is 1000. Returns: None. diff --git a/model_zoo/official/cv/nasnet/src/dataset.py b/model_zoo/official/cv/nasnet/src/dataset.py index 743ab2a774..520d33e3b3 100755 --- a/model_zoo/official/cv/nasnet/src/dataset.py +++ b/model_zoo/official/cv/nasnet/src/dataset.py @@ -47,7 +47,6 @@ def create_dataset(dataset_path, config, do_train, repeat_num=1): C.RandomCropDecodeResize(config.image_size), C.RandomHorizontalFlip(prob=0.5), C.RandomColorAdjust(brightness=0.4, saturation=0.5) # fast mode - # C.RandomColorAdjust(brightness=0.4, contrast=0.5, saturation=0.5, hue=0.2) ] else: trans = [ diff --git a/model_zoo/official/cv/resnet_thor/src/dataset_helper.py b/model_zoo/official/cv/resnet_thor/src/dataset_helper.py index bb4109c8e0..b9e46a8b68 100644 --- a/model_zoo/official/cv/resnet_thor/src/dataset_helper.py +++ b/model_zoo/official/cv/resnet_thor/src/dataset_helper.py @@ -151,7 +151,7 @@ class _DatasetIter: class _DatasetIterMSLoopSink(_DatasetIter): - """Iter for context (device_target=Ascend)""" + """Iter for context when device_target is Ascend""" def __init__(self, dataset, sink_size, epoch_num, iter_first_order): super().__init__(dataset, sink_size, epoch_num) sink_count = 1 @@ -179,7 +179,7 @@ class _DatasetIterMSLoopSink(_DatasetIter): class _DatasetIterMS(_DatasetIter): - """Iter for MS(enable_loop_sink=False).""" + """Iter for MS when enable_loop_sink is False.""" def __init__(self, dataset, sink_size, epoch_num): super().__init__(dataset, sink_size, epoch_num) if sink_size > 0: diff --git a/model_zoo/official/cv/resnet_thor/src/resnet_thor.py b/model_zoo/official/cv/resnet_thor/src/resnet_thor.py index 937e78939b..8d75bed882 100644 --- a/model_zoo/official/cv/resnet_thor/src/resnet_thor.py +++ b/model_zoo/official/cv/resnet_thor/src/resnet_thor.py @@ -283,7 +283,7 @@ class ResNet(nn.Cell): frequency=frequency, batch_size=batch_size) self.bn1 = _bn(64) self.relu = P.ReLU() - # self.maxpool = P.MaxPoolWithArgmax(padding="same", ksize=3, strides=2) + self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, pad_mode="same") self.layer1 = self._make_layer(block, diff --git a/model_zoo/official/cv/resnext50/README.md b/model_zoo/official/cv/resnext50/README.md index 18dc435324..89e8e621c0 100644 --- a/model_zoo/official/cv/resnext50/README.md +++ b/model_zoo/official/cv/resnext50/README.md @@ -56,7 +56,7 @@ For FP16 operators, if the input data type is FP32, the backend of MindSpore wil - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend , please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/resnext50/src/utils/optimizers__init__.py b/model_zoo/official/cv/resnext50/src/utils/optimizers__init__.py index d4683959b5..b1863eed7d 100644 --- a/model_zoo/official/cv/resnext50/src/utils/optimizers__init__.py +++ b/model_zoo/official/cv/resnext50/src/utils/optimizers__init__.py @@ -23,15 +23,12 @@ def get_param_groups(network): parameter_name = x.name if parameter_name.endswith('.bias'): # all bias not using weight decay - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) elif parameter_name.endswith('.gamma'): # bn weight bias not using weight decay, be carefully for now x not include BN - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) elif parameter_name.endswith('.beta'): # bn weight bias not using weight decay, be carefully for now x not include BN - # print('no decay:{}'.format(parameter_name)) no_decay_params.append(x) else: decay_params.append(x) diff --git a/model_zoo/official/cv/shufflenetv2/Readme.md b/model_zoo/official/cv/shufflenetv2/Readme.md index b975d95131..20b43206cf 100644 --- a/model_zoo/official/cv/shufflenetv2/Readme.md +++ b/model_zoo/official/cv/shufflenetv2/Readme.md @@ -40,7 +40,7 @@ Dataset used: [imagenet](http://www.image-net.org/) - Hardware(GPU) - Prepare hardware environment with GPU processor. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/cv/shufflenetv2/src/dataset.py b/model_zoo/official/cv/shufflenetv2/src/dataset.py index c04bed7d0f..af4fbf0c19 100644 --- a/model_zoo/official/cv/shufflenetv2/src/dataset.py +++ b/model_zoo/official/cv/shufflenetv2/src/dataset.py @@ -66,7 +66,6 @@ def create_dataset(dataset_path, do_train, rank, group_size, repeat_num=1): trans += [ toBGR(), C.Rescale(1.0 / 255.0, 0.0), - # C.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), C.HWC2CHW(), C2.TypeCast(mstype.float32) ] diff --git a/model_zoo/official/cv/shufflenetv2/src/shufflenetv2.py b/model_zoo/official/cv/shufflenetv2/src/shufflenetv2.py index 349d62a91f..c3de3242f7 100644 --- a/model_zoo/official/cv/shufflenetv2/src/shufflenetv2.py +++ b/model_zoo/official/cv/shufflenetv2/src/shufflenetv2.py @@ -79,7 +79,6 @@ class ShuffleV2Block(nn.Cell): def channel_shuffle(self, x): batchsize, num_channels, height, width = P.Shape()(x) - ##assert (num_channels % 4 == 0) x = P.Reshape()(x, (batchsize * num_channels // 2, 2, height * width,)) x = P.Transpose()(x, (1, 0, 2,)) x = P.Reshape()(x, (2, -1, num_channels // 2, height, width,)) diff --git a/model_zoo/official/cv/ssd/src/dataset.py b/model_zoo/official/cv/ssd/src/dataset.py index 20030475a0..ae02edce2a 100644 --- a/model_zoo/official/cv/ssd/src/dataset.py +++ b/model_zoo/official/cv/ssd/src/dataset.py @@ -162,7 +162,6 @@ def create_voc_label(is_training): voc_dir = config.voc_dir cls_map = {name: i for i, name in enumerate(config.coco_classes)} sub_dir = 'train' if is_training else 'eval' - # sub_dir = 'train' voc_dir = os.path.join(voc_dir, sub_dir) if not os.path.isdir(voc_dir): raise ValueError(f'Cannot find {sub_dir} dataset path.') diff --git a/model_zoo/official/cv/vgg16/train.py b/model_zoo/official/cv/vgg16/train.py index 9a81f34ecc..fc82fbc1e1 100644 --- a/model_zoo/official/cv/vgg16/train.py +++ b/model_zoo/official/cv/vgg16/train.py @@ -14,7 +14,6 @@ # ============================================================================ """ #################train vgg16 example on cifar10######################## -python train.py --data_path=$DATA_HOME --device_id=$DEVICE_ID """ import argparse import datetime diff --git a/model_zoo/official/cv/yolov3_darknet53/src/transforms.py b/model_zoo/official/cv/yolov3_darknet53/src/transforms.py index da0b313cf7..4f2a4bb17e 100644 --- a/model_zoo/official/cv/yolov3_darknet53/src/transforms.py +++ b/model_zoo/official/cv/yolov3_darknet53/src/transforms.py @@ -146,7 +146,7 @@ def _preprocess_true_boxes(true_boxes, anchors, in_shape, num_classes, # input_shape is [h, w] true_boxes[..., 0:2] = boxes_xy / input_shape[::-1] true_boxes[..., 2:4] = boxes_wh / input_shape[::-1] - # true_boxes = [xywh] + # true_boxes [x, y, w, h] grid_shapes = [input_shape // 32, input_shape // 16, input_shape // 8] # grid_shape [h, w] diff --git a/model_zoo/official/cv/yolov3_darknet53_quant/src/transforms.py b/model_zoo/official/cv/yolov3_darknet53_quant/src/transforms.py index 837d1a25ea..a240338007 100644 --- a/model_zoo/official/cv/yolov3_darknet53_quant/src/transforms.py +++ b/model_zoo/official/cv/yolov3_darknet53_quant/src/transforms.py @@ -153,7 +153,7 @@ def _preprocess_true_boxes(true_boxes, anchors, in_shape, num_classes, # input_shape is [h, w] true_boxes[..., 0:2] = boxes_xy / input_shape[::-1] true_boxes[..., 2:4] = boxes_wh / input_shape[::-1] - # true_boxes = [xywh] + # true_boxes [x, y, w, h] grid_shapes = [input_shape // 32, input_shape // 16, input_shape // 8] # grid_shape [h, w] diff --git a/model_zoo/official/cv/yolov3_resnet18/src/dataset.py b/model_zoo/official/cv/yolov3_resnet18/src/dataset.py index 48c6c13ae6..b6c37cfccf 100644 --- a/model_zoo/official/cv/yolov3_resnet18/src/dataset.py +++ b/model_zoo/official/cv/yolov3_resnet18/src/dataset.py @@ -44,7 +44,6 @@ def preprocess_fn(image, box, is_training): num_layers = anchors.shape[0] // 3 anchor_mask = [[6, 7, 8], [3, 4, 5], [0, 1, 2]] true_boxes = np.array(true_boxes, dtype='float32') - # input_shape = np.array([in_shape, in_shape], dtype='int32') input_shape = np.array(in_shape, dtype='int32') boxes_xy = (true_boxes[..., 0:2] + true_boxes[..., 2:4]) // 2. boxes_wh = true_boxes[..., 2:4] - true_boxes[..., 0:2] diff --git a/model_zoo/official/nlp/bert/pretrain_eval.py b/model_zoo/official/nlp/bert/pretrain_eval.py index b8cb760dd0..4bf503b3fc 100644 --- a/model_zoo/official/nlp/bert/pretrain_eval.py +++ b/model_zoo/official/nlp/bert/pretrain_eval.py @@ -105,7 +105,7 @@ class BertPretrainEva(nn.Cell): def get_enwiki_512_dataset(batch_size=1, repeat_count=1, distribute_file=''): ''' - Get enwiki seq_length=512 dataset + Get enwiki dataset when seq_length is 512. ''' ds = de.TFRecordDataset([cfg.data_file], cfg.schema_file, columns_list=["input_ids", "input_mask", "segment_ids", "masked_lm_positions", "masked_lm_ids", diff --git a/model_zoo/official/nlp/bert/src/bert_model.py b/model_zoo/official/nlp/bert/src/bert_model.py index 9115045620..5fb7d90177 100644 --- a/model_zoo/official/nlp/bert/src/bert_model.py +++ b/model_zoo/official/nlp/bert/src/bert_model.py @@ -490,7 +490,7 @@ class BertAttention(nn.Cell): # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_keys' = [F|T, F|T, H] + # relations_keys is [F|T, F|T, H] relations_keys = self._generate_relative_positions_embeddings() relations_keys = self.cast_compute_type(relations_keys) # query_layer_t is [F, B, N, H] @@ -533,7 +533,7 @@ class BertAttention(nn.Cell): # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_values' = [F|T, F|T, H] + # relations_values is [F|T, F|T, H] relations_values = self._generate_relative_positions_embeddings() relations_values = self.cast_compute_type(relations_values) # attention_probs_t is [F, B, N, T] diff --git a/model_zoo/official/nlp/bert/src/utils.py b/model_zoo/official/nlp/bert/src/utils.py index 77c71d2b88..5b0761ce51 100644 --- a/model_zoo/official/nlp/bert/src/utils.py +++ b/model_zoo/official/nlp/bert/src/utils.py @@ -165,7 +165,6 @@ def LoadNewestCkpt(load_finetune_checkpoint_dir, steps_per_epoch, epoch_num, pre name_ext = os.path.splitext(filename) if name_ext[-1] != ".ckpt": continue - #steps_per_epoch = ds.get_dataset_size() if filename.find(prefix) == 0 and not filename[pre_len].isalpha(): index = filename[pre_len:].find("-") if index == 0 and max_num == 0: diff --git a/model_zoo/official/nlp/bert_thor/README.md b/model_zoo/official/nlp/bert_thor/README.md index 80ed17b42c..a76accff33 100644 --- a/model_zoo/official/nlp/bert_thor/README.md +++ b/model_zoo/official/nlp/bert_thor/README.md @@ -49,7 +49,7 @@ The classical first-order optimization algorithm, such as SGD, has a small amoun - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend , please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/nlp/bert_thor/pretrain_eval.py b/model_zoo/official/nlp/bert_thor/pretrain_eval.py index e32295d064..ea7c563dcc 100644 --- a/model_zoo/official/nlp/bert_thor/pretrain_eval.py +++ b/model_zoo/official/nlp/bert_thor/pretrain_eval.py @@ -110,7 +110,7 @@ class BertPretrainEva(nn.Cell): def get_enwiki_512_dataset(batch_size=1, repeat_count=1, distribute_file=''): ''' - Get enwiki seq_length=512 dataset + Get enwiki dataset when seq_length is 512. ''' ds = de.TFRecordDataset([cfg.data_file], cfg.schema_file, columns_list=["input_ids", "input_mask", "segment_ids", "masked_lm_positions", "masked_lm_ids", diff --git a/model_zoo/official/nlp/bert_thor/src/bert_model.py b/model_zoo/official/nlp/bert_thor/src/bert_model.py index a19f91aeeb..d31b822b9e 100644 --- a/model_zoo/official/nlp/bert_thor/src/bert_model.py +++ b/model_zoo/official/nlp/bert_thor/src/bert_model.py @@ -566,7 +566,7 @@ class BertAttention(nn.Cell): # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_keys' = [F|T, F|T, H] + # relations_keys is [F|T, F|T, H] relations_keys = self._generate_relative_positions_embeddings() relations_keys = self.cast_compute_type(relations_keys) # query_layer_t is [F, B, N, H] @@ -609,7 +609,7 @@ class BertAttention(nn.Cell): # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_values' = [F|T, F|T, H] + # relations_values is [F|T, F|T, H] relations_values = self._generate_relative_positions_embeddings() relations_values = self.cast_compute_type(relations_values) # attention_probs_t is [F, B, N, T] diff --git a/model_zoo/official/nlp/bert_thor/src/dataset_helper.py b/model_zoo/official/nlp/bert_thor/src/dataset_helper.py index 9a011450c9..80529faae4 100644 --- a/model_zoo/official/nlp/bert_thor/src/dataset_helper.py +++ b/model_zoo/official/nlp/bert_thor/src/dataset_helper.py @@ -155,7 +155,7 @@ class _DatasetIter: class _DatasetIterMSLoopSink(_DatasetIter): - """Iter for context (device_target=Ascend)""" + """Iter for context, the device_target is Ascend.""" def __init__(self, dataset, sink_size, epoch_num, iter_first_order): super().__init__(dataset, sink_size, epoch_num) diff --git a/model_zoo/official/nlp/bert_thor/src/thor_for_bert.py b/model_zoo/official/nlp/bert_thor/src/thor_for_bert.py index 60e40d41c0..36c20a7992 100644 --- a/model_zoo/official/nlp/bert_thor/src/thor_for_bert.py +++ b/model_zoo/official/nlp/bert_thor/src/thor_for_bert.py @@ -198,7 +198,7 @@ class THOR(Optimizer): g = F.depend(g, fake_G) new_grads = new_grads + (g, pooler_bias) - # for cls1 fc layer: mlm + # cls1 fully connect layer for masked language model(mlm) mlm_fc_idx = encoder_layers_num * self.num_hidden_layers + 8 matrix_idx = self.num_hidden_layers * 6 + 4 g = gradients[mlm_fc_idx] @@ -327,7 +327,7 @@ class THOR(Optimizer): g = self.cast(g, mstype.float32) new_grads = new_grads + (g, pooler_bias) - # for cls1 fc layer: mlm + # cls1 fully connect layer for masked language model(mlm) mlm_fc_idx = encoder_layers_num * self.num_hidden_layers + 8 matrix_idx = self.num_hidden_layers * 6 + 4 g = gradients[mlm_fc_idx] diff --git a/model_zoo/official/nlp/bert_thor/src/thor_for_bert_arg.py b/model_zoo/official/nlp/bert_thor/src/thor_for_bert_arg.py index 0cc7e33276..c1835b6e3b 100644 --- a/model_zoo/official/nlp/bert_thor/src/thor_for_bert_arg.py +++ b/model_zoo/official/nlp/bert_thor/src/thor_for_bert_arg.py @@ -203,7 +203,7 @@ class THOR(Optimizer): g = F.depend(g, fake_G) new_grads = new_grads + (g, pooler_bias) - # for cls1 fc layer: mlm + # cls1 fully connect layer for masked language model(mlm) mlm_fc_idx = encoder_layers_num * self.num_hidden_layers + 8 matrix_idx = self.num_hidden_layers * 6 + 4 g = gradients[mlm_fc_idx] @@ -333,7 +333,7 @@ class THOR(Optimizer): g = self.cast(g, mstype.float32) new_grads = new_grads + (g, pooler_bias) - # for cls1 fc layer: mlm + # cls1 fully connect layer for masked language model(mlm) mlm_fc_idx = encoder_layers_num * self.num_hidden_layers + 8 matrix_idx = self.num_hidden_layers * 6 + 4 g = gradients[mlm_fc_idx] diff --git a/model_zoo/official/nlp/bert_thor/src/utils.py b/model_zoo/official/nlp/bert_thor/src/utils.py index 9366f71246..6bed08c8de 100644 --- a/model_zoo/official/nlp/bert_thor/src/utils.py +++ b/model_zoo/official/nlp/bert_thor/src/utils.py @@ -129,7 +129,6 @@ def LoadNewestCkpt(load_finetune_checkpoint_dir, steps_per_epoch, epoch_num, pre name_ext = os.path.splitext(filename) if name_ext[-1] != ".ckpt": continue - # steps_per_epoch = ds.get_dataset_size() if filename.find(prefix) == 0 and not filename[pre_len].isalpha(): index = filename[pre_len:].find("-") if index == 0 and max_num == 0: diff --git a/model_zoo/official/nlp/lstm/eval.py b/model_zoo/official/nlp/lstm/eval.py index 8bb139c65c..f9960ce55f 100644 --- a/model_zoo/official/nlp/lstm/eval.py +++ b/model_zoo/official/nlp/lstm/eval.py @@ -14,7 +14,6 @@ # ============================================================================ """ #################train lstm example on aclImdb######################## -python eval.py --ckpt_path=./lstm-20-390.ckpt """ import argparse import os diff --git a/model_zoo/official/nlp/lstm/src/imdb.py b/model_zoo/official/nlp/lstm/src/imdb.py index 9888b4c36f..042ef092b8 100644 --- a/model_zoo/official/nlp/lstm/src/imdb.py +++ b/model_zoo/official/nlp/lstm/src/imdb.py @@ -103,7 +103,7 @@ class ImdbParser(): vocab = set(chain(*tokenized_features)) self.__vacab[seg] = vocab - # word_to_idx: {'hello': 1, 'world':111, ... '': 0} + # word_to_idx looks like {'hello': 1, 'world':111, ... '': 0} word_to_idx = {word: i + 1 for i, word in enumerate(vocab)} word_to_idx[''] = 0 self.__word2idx[seg] = word_to_idx @@ -147,7 +147,7 @@ class ImdbParser(): def get_datas(self, seg): """ - return features, labels, and weight + get features, labels, and weight by gensim. """ features = np.array(self.__features[seg]).astype(np.int32) labels = np.array(self.__labels[seg]).astype(np.int32) diff --git a/model_zoo/official/nlp/lstm/train.py b/model_zoo/official/nlp/lstm/train.py index 7fa625db04..a52b7cc29e 100644 --- a/model_zoo/official/nlp/lstm/train.py +++ b/model_zoo/official/nlp/lstm/train.py @@ -14,7 +14,6 @@ # ============================================================================ """ #################train lstm example on aclImdb######################## -python train.py --preprocess=true --aclimdb_path=your_imdb_path --glove_path=your_glove_path """ import argparse import os diff --git a/model_zoo/official/nlp/mass/README.md b/model_zoo/official/nlp/mass/README.md index 95b81a9d72..564e42488e 100644 --- a/model_zoo/official/nlp/mass/README.md +++ b/model_zoo/official/nlp/mass/README.md @@ -472,7 +472,7 @@ More detail about LR scheduler could be found in `src/utils/lr_scheduler.py`. - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend , please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/official/nlp/mass/src/transformer/beam_search.py b/model_zoo/official/nlp/mass/src/transformer/beam_search.py index 0c48aa3cf0..4ab25847c6 100644 --- a/model_zoo/official/nlp/mass/src/transformer/beam_search.py +++ b/model_zoo/official/nlp/mass/src/transformer/beam_search.py @@ -94,7 +94,6 @@ class TileBeam(nn.Cell): # add an dim input_tensor = self.expand(input_tensor, 1) # get tile shape: [1, beam, ...] - # shape = self.shape(input_tensor) tile_shape = (1,) + (self.beam_width,) for _ in range(len(shape) - 1): tile_shape = tile_shape + (1,) @@ -349,7 +348,7 @@ class BeamSearchDecoder(nn.Cell): # add length penalty scores penalty_len = self.length_penalty(state_length) - # return penalty_len + # get penalty length log_probs = self.real_div(state_log_probs, penalty_len) # sort according to scores diff --git a/model_zoo/official/nlp/tinybert/src/tinybert_for_gd_td.py b/model_zoo/official/nlp/tinybert/src/tinybert_for_gd_td.py index 8f690d7785..ae93d955a3 100644 --- a/model_zoo/official/nlp/tinybert/src/tinybert_for_gd_td.py +++ b/model_zoo/official/nlp/tinybert/src/tinybert_for_gd_td.py @@ -383,7 +383,6 @@ class BertNetworkWithLoss_td(nn.Cell): if is_predistill: new_param_dict = {} for key, value in param_dict.items(): - # new_key = re.sub('tinybert_', 'bert_', key) new_key = re.sub('tinybert_', 'bert_', 'bert.' + key) new_param_dict[new_key] = value load_param_into_net(self.bert, new_param_dict) @@ -391,7 +390,6 @@ class BertNetworkWithLoss_td(nn.Cell): new_param_dict = {} for key, value in param_dict.items(): new_key = re.sub('tinybert_', 'bert_', key) - # new_key = re.sub('tinybert_', 'bert_', 'bert.'+ key) new_param_dict[new_key] = value load_param_into_net(self.bert, new_param_dict) self.cast = P.Cast() diff --git a/model_zoo/official/nlp/tinybert/src/tinybert_model.py b/model_zoo/official/nlp/tinybert/src/tinybert_model.py index c452085220..eaaf00fb54 100644 --- a/model_zoo/official/nlp/tinybert/src/tinybert_model.py +++ b/model_zoo/official/nlp/tinybert/src/tinybert_model.py @@ -502,7 +502,7 @@ class BertAttention(nn.Cell): attention_scores = self.matmul_trans_b(query_layer, key_layer) # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_keys' = [F|T, F|T, H] + # relations_keys is [F|T, F|T, H] relations_keys = self._generate_relative_positions_embeddings() relations_keys = self.cast_compute_type(relations_keys) # query_layer_t is [F, B, N, H] @@ -539,7 +539,7 @@ class BertAttention(nn.Cell): context_layer = self.matmul(attention_probs, value_layer) # use_relative_position, supplementary logic if self.use_relative_positions: - # 'relations_values' = [F|T, F|T, H] + # relations_values is [F|T, F|T, H] relations_values = self._generate_relative_positions_embeddings() relations_values = self.cast_compute_type(relations_values) # attention_probs_t is [F, B, N, T] diff --git a/model_zoo/official/nlp/transformer/src/beam_search.py b/model_zoo/official/nlp/transformer/src/beam_search.py index ae437c883f..ffa3dfbac3 100644 --- a/model_zoo/official/nlp/transformer/src/beam_search.py +++ b/model_zoo/official/nlp/transformer/src/beam_search.py @@ -258,7 +258,7 @@ class BeamSearchDecoder(nn.Cell): # add length penalty scores penalty_len = self.length_penalty(state_length) - # return penalty_len + # get penalty length log_probs = self.real_div(state_log_probs, penalty_len) # sort according to scores diff --git a/model_zoo/official/nlp/transformer/src/transformer_for_train.py b/model_zoo/official/nlp/transformer/src/transformer_for_train.py index 5f04f3a7d1..4eebdad4c8 100644 --- a/model_zoo/official/nlp/transformer/src/transformer_for_train.py +++ b/model_zoo/official/nlp/transformer/src/transformer_for_train.py @@ -55,7 +55,7 @@ class ClipGradients(nn.Cell): grads, clip_type, clip_value): - """return grads""" + """Defines the gradients clip.""" if clip_type != 0 and clip_type != 1: return grads diff --git a/model_zoo/official/recommend/wide_and_deep_multitable/src/wide_and_deep.py b/model_zoo/official/recommend/wide_and_deep_multitable/src/wide_and_deep.py index 9904ef028d..1cb45ca2ed 100644 --- a/model_zoo/official/recommend/wide_and_deep_multitable/src/wide_and_deep.py +++ b/model_zoo/official/recommend/wide_and_deep_multitable/src/wide_and_deep.py @@ -156,6 +156,7 @@ class WideDeepModel(nn.Cell): emb64_multi_size = 20900 indicator_size = 16 deep_dim_list = [1024, 1024, 1024, 1024, 1024] + wide_reg_coef = [0.0, 0.0] deep_reg_coef = [0.0, 0.0] wide_lr = 0.2 diff --git a/model_zoo/research/cv/ghostnet/Readme.md b/model_zoo/research/cv/ghostnet/Readme.md index a84393eba2..bd5004accc 100644 --- a/model_zoo/research/cv/ghostnet/Readme.md +++ b/model_zoo/research/cv/ghostnet/Readme.md @@ -43,7 +43,7 @@ Dataset used: [Oxford-IIIT Pet](https://www.robots.ox.ac.uk/~vgg/data/pets/) - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/research/cv/ghostnet/src/ghostnet600.py b/model_zoo/research/cv/ghostnet/src/ghostnet600.py index 66e673cb8e..699e234e9f 100644 --- a/model_zoo/research/cv/ghostnet/src/ghostnet600.py +++ b/model_zoo/research/cv/ghostnet/src/ghostnet600.py @@ -335,7 +335,6 @@ class GhostNet(nn.Cell): self.blocks = [] for layer_cfg in self.cfgs: - #print (layer_cfg) self.blocks.append(self._make_layer(kernel_size=layer_cfg[0], exp_ch=_make_divisible( self.inplanes * layer_cfg[3]), diff --git a/model_zoo/research/cv/ghostnet_quant/Readme.md b/model_zoo/research/cv/ghostnet_quant/Readme.md index 4525ac4ceb..3343aa666e 100644 --- a/model_zoo/research/cv/ghostnet_quant/Readme.md +++ b/model_zoo/research/cv/ghostnet_quant/Readme.md @@ -48,7 +48,7 @@ Dataset used: [Oxford-IIIT Pet](https://www.robots.ox.ac.uk/~vgg/data/pets/) - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/research/cv/ghostnet_quant/src/ghostnet.py b/model_zoo/research/cv/ghostnet_quant/src/ghostnet.py index c9cfa852d6..1ae33d39d5 100644 --- a/model_zoo/research/cv/ghostnet_quant/src/ghostnet.py +++ b/model_zoo/research/cv/ghostnet_quant/src/ghostnet.py @@ -105,7 +105,7 @@ class SE(nn.Cell): SE warpper definition. Args: - num_out (int): Output channel. + num_out (int): output channel. ratio (int): middle output ratio. Returns: diff --git a/model_zoo/research/cv/resnet50_adv_pruning/Readme.md b/model_zoo/research/cv/resnet50_adv_pruning/Readme.md index 53c87906dd..ee4bc6b743 100644 --- a/model_zoo/research/cv/resnet50_adv_pruning/Readme.md +++ b/model_zoo/research/cv/resnet50_adv_pruning/Readme.md @@ -36,7 +36,7 @@ Dataset used: [Oxford-IIIT Pet](https://www.robots.ox.ac.uk/~vgg/data/pets/) - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/research/cv/ssd_ghostnet/README.md b/model_zoo/research/cv/ssd_ghostnet/README.md index 5126fa1282..a4a68db118 100644 --- a/model_zoo/research/cv/ssd_ghostnet/README.md +++ b/model_zoo/research/cv/ssd_ghostnet/README.md @@ -23,7 +23,7 @@ Dataset used: [COCO2017]() - Hardware(Ascend/GPU) - Prepare hardware environment with Ascend or GPU processor. If you want to try Ascend, please send the [application form](https://obs-9be7.obs.cn-east-2.myhuaweicloud.com/file/other/Ascend%20Model%20Zoo%E4%BD%93%E9%AA%8C%E8%B5%84%E6%BA%90%E7%94%B3%E8%AF%B7%E8%A1%A8.docx) to ascend@huawei.com. Once approved, you can get the resources. - Framework - - [MindSpore](http://10.90.67.50/mindspore/archive/20200506/OpenSource/me_vm_x86/) + - [MindSpore](https://www.mindspore.cn/install/en) - For more information, please check the resources below: - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html) - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html) diff --git a/model_zoo/research/cv/ssd_ghostnet/src/ssd_ghostnet.py b/model_zoo/research/cv/ssd_ghostnet/src/ssd_ghostnet.py index 5c3e3d4e72..f109d115aa 100644 --- a/model_zoo/research/cv/ssd_ghostnet/src/ssd_ghostnet.py +++ b/model_zoo/research/cv/ssd_ghostnet/src/ssd_ghostnet.py @@ -84,7 +84,6 @@ class ConvBNReLU(nn.Cell): def construct(self, x): output = self.features(x) - # print(output.shape) return output @@ -267,8 +266,6 @@ class GhostModule(nn.Cell): def construct(self, x): x1 = self.primary_conv(x) x2 = self.cheap_operation(x1) - # print(x1.shape) - # print(x2.shape) return self.concat((x1, x2)) @@ -342,7 +339,6 @@ class GhostBottleneck(nn.Cell): out = self.add(shortcut, out) if self.last_relu: out = self.relu(out) - # print(out.shape) return out def _get_pad(self, kernel_size): @@ -410,7 +406,6 @@ class InvertedResidual(nn.Cell): x = self.add(identity, x) if self.last_relu: x = self.relu(x) - # print(x.shape) return x @@ -675,7 +670,6 @@ class SSDWithGhostNet(nn.Cell): def __init__(self, model_cfgs, multiplier=1., round_nearest=8): super(SSDWithGhostNet, self).__init__() self.cfgs = model_cfgs['cfg'] - # self.inplanes = 16 ## for "1x" self.inplanes = 20 # for "1.3x" first_conv_in_channel = 3 first_conv_out_channel = _make_divisible(multiplier * self.inplanes) @@ -686,7 +680,6 @@ class SSDWithGhostNet(nn.Cell): layer_index = 0 for layer_cfg in self.cfgs: - # print(layer_cfg) if layer_index == 11: hidden_dim = int(round(self.inplanes * 6)) self.expand_layer_conv_11 = ConvBNReLU( @@ -711,7 +704,6 @@ class SSDWithGhostNet(nn.Cell): def _make_layer(self, kernel_size, exp_ch, out_channel, use_se, act_func, stride=1): mid_planes = exp_ch out_planes = out_channel - # num_in, num_mid, num_out, kernel_size, stride=1, act_type='relu', use_se=False): layer = GhostBottleneck(self.inplanes, mid_planes, out_planes, kernel_size, stride=stride, act_type=act_func, use_se=use_se) self.inplanes = out_planes diff --git a/model_zoo/research/cv/ssd_ghostnet/train.py b/model_zoo/research/cv/ssd_ghostnet/train.py index 85c7d86f1a..1388d74fce 100644 --- a/model_zoo/research/cv/ssd_ghostnet/train.py +++ b/model_zoo/research/cv/ssd_ghostnet/train.py @@ -23,10 +23,8 @@ from mindspore import context, Tensor from mindspore.communication.management import init from mindspore.train.callback import CheckpointConfig, ModelCheckpoint, LossMonitor, TimeMonitor from mindspore.train import Model, ParallelMode -# from mindspore.context import ParallelMode from mindspore.train.serialization import load_checkpoint, load_param_into_net from src.ssd_ghostnet import SSD300, SSDWithLossCell, TrainingWrapper, ssd_ghostnet -# from src.config_ghostnet_1x import config from src.config_ghostnet_13x import config from src.dataset import create_ssd_dataset, data_to_mindrecord_byte_image, voc_data_to_mindrecord from src.lr_schedule import get_lr @@ -124,7 +122,6 @@ def main(): backbone = ssd_ghostnet() ssd = SSD300(backbone=backbone, config=config) - # print(ssd) net = SSDWithLossCell(ssd, config) init_net_param(net) diff --git a/model_zoo/utils/graph_to_mindrecord/writer.py b/model_zoo/utils/graph_to_mindrecord/writer.py index 9dce63e265..b0272b7d0d 100644 --- a/model_zoo/utils/graph_to_mindrecord/writer.py +++ b/model_zoo/utils/graph_to_mindrecord/writer.py @@ -149,7 +149,6 @@ if __name__ == "__main__": # pass mr_api arguments os.environ['graph_api_args'] = args.graph_api_args - # import mr_api try: mr_api = import_module(args.mindrecord_script + '.mr_api') except ModuleNotFoundError: diff --git a/tests/st/model_zoo_tests/wide_and_deep/python_file_for_ci/wide_and_deep.py b/tests/st/model_zoo_tests/wide_and_deep/python_file_for_ci/wide_and_deep.py index 09bb2a1e11..9a0eeecc7f 100644 --- a/tests/st/model_zoo_tests/wide_and_deep/python_file_for_ci/wide_and_deep.py +++ b/tests/st/model_zoo_tests/wide_and_deep/python_file_for_ci/wide_and_deep.py @@ -13,22 +13,19 @@ # limitations under the License. # ============================================================================ """wide and deep model""" +import numpy as np from mindspore import nn from mindspore import Parameter, ParameterTuple import mindspore.common.dtype as mstype from mindspore.ops import functional as F from mindspore.ops import composite as C from mindspore.ops import operations as P -# from mindspore.nn import Dropout from mindspore.nn.optim import Adam, FTRL -# from mindspore.nn.metrics import Metric from mindspore.common.initializer import Uniform, initializer -# from mindspore.train.callback import ModelCheckpoint, CheckpointConfig from mindspore.parallel._utils import _get_device_num, _get_parallel_mode, _get_gradients_mean from mindspore.context import ParallelMode from mindspore.nn.wrap.grad_reducer import DistributedGradReducer from mindspore.communication.management import get_group_size -import numpy as np np_type = np.float32 ms_type = mstype.float32 @@ -110,8 +107,6 @@ class DenseLayer(nn.Cell): def construct(self, x): x = self.act_func(x) - # if self.training: - # x = self.dropout(x) x = self.mul(x, self.scale_coef) if self.convert_dtype: x = self.cast(x, mstype.float16) diff --git a/tests/st/networks/models/bert/src/fused_layer_norm.py b/tests/st/networks/models/bert/src/fused_layer_norm.py index 5dbe9999ad..0e5c19f654 100644 --- a/tests/st/networks/models/bert/src/fused_layer_norm.py +++ b/tests/st/networks/models/bert/src/fused_layer_norm.py @@ -13,6 +13,7 @@ # limitations under the License. # ============================================================================ """fused layernorm""" +import numpy as np from mindspore.ops import operations as P from mindspore.ops import functional as F from mindspore.common.parameter import Parameter @@ -21,8 +22,6 @@ from mindspore.ops.primitive import constexpr import mindspore.common.dtype as mstype from mindspore.nn.cell import Cell -import numpy as np - __all__ = ['FusedLayerNorm'] diff --git a/tests/st/networks/models/deeplabv3/src/md_dataset.py b/tests/st/networks/models/deeplabv3/src/md_dataset.py index 21f8f70db9..af62fe0fb9 100644 --- a/tests/st/networks/models/deeplabv3/src/md_dataset.py +++ b/tests/st/networks/models/deeplabv3/src/md_dataset.py @@ -13,10 +13,10 @@ # limitations under the License. # ============================================================================ """Dataset module.""" +import numpy as np from PIL import Image import mindspore.dataset as de import mindspore.dataset.vision.c_transforms as C -import numpy as np from .ei_dataset import HwVocRawDataset from .utils import custom_transforms as tr