diff --git a/model_zoo/official/cv/centerface/mindspore_hub_conf.py b/model_zoo/official/cv/centerface/mindspore_hub_conf.py new file mode 100644 index 00000000000..d59867442a7 --- /dev/null +++ b/model_zoo/official/cv/centerface/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.centerface import CenterfaceMobilev2 + +def centerface(*args, **kwargs): + return CenterfaceMobilev2(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "centerface": + return CenterfaceMobilev2(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/cnnctc/mindspore_hub_conf.py b/model_zoo/official/cv/cnnctc/mindspore_hub_conf.py new file mode 100644 index 00000000000..969f1f94af2 --- /dev/null +++ b/model_zoo/official/cv/cnnctc/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.cnn_ctc import CNNCTC_Model + +def cnnctc(*args, **kwargs): + return CNNCTC_Model(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "cnnctc": + return CNNCTC_Model(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/efficientnet/mindspore_hub_conf.py b/model_zoo/official/cv/efficientnet/mindspore_hub_conf.py new file mode 100644 index 00000000000..bec008323a3 --- /dev/null +++ b/model_zoo/official/cv/efficientnet/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.efficientnet import efficientnet_b0 + +def efficinetnet(*args, **kwargs): + return efficientnet_b0(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "efficinetnet": + return efficientnet_b0(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/inceptionv4/mindspore_hub_conf.py b/model_zoo/official/cv/inceptionv4/mindspore_hub_conf.py new file mode 100644 index 00000000000..8ddb0ca4032 --- /dev/null +++ b/model_zoo/official/cv/inceptionv4/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.inceptionv4 import Inceptionv4 + +def inceptionv4_net(*args, **kwargs): + return Inceptionv4(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "inceptionv4": + return Inceptionv4(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/inceptionv4/src/__init__.py b/model_zoo/official/cv/inceptionv4/src/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/model_zoo/official/cv/mobilenetv1/mindspore_hub_conf.py b/model_zoo/official/cv/mobilenetv1/mindspore_hub_conf.py new file mode 100644 index 00000000000..fb99914be64 --- /dev/null +++ b/model_zoo/official/cv/mobilenetv1/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.mobilenet_v1 import mobilenet_v1 + +def mobilenetv1(*args, **kwargs): + return mobilenet_v1(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "mobilenetv1": + return mobilenet_v1(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/openpose/mindspore_hub_conf.py b/model_zoo/official/cv/openpose/mindspore_hub_conf.py new file mode 100644 index 00000000000..5dd51aae8c6 --- /dev/null +++ b/model_zoo/official/cv/openpose/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.openposenet import OpenPoseNet + +def openposenet(*args, **kwargs): + return OpenPoseNet(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "openposenet": + return OpenPoseNet(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/shufflenetv1/mindspore_hub_conf.py b/model_zoo/official/cv/shufflenetv1/mindspore_hub_conf.py new file mode 100644 index 00000000000..4e63e881659 --- /dev/null +++ b/model_zoo/official/cv/shufflenetv1/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.shufflenetv1 import ShuffleNetV1 + +def shufflenetv1(*args, **kwargs): + return ShuffleNetV1(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "shufflenetv1": + return ShuffleNetV1(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/shufflenetv2/mindspore_hub_conf.py b/model_zoo/official/cv/shufflenetv2/mindspore_hub_conf.py new file mode 100644 index 00000000000..87a10a2c083 --- /dev/null +++ b/model_zoo/official/cv/shufflenetv2/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.shufflenetv2 import ShuffleNetV2 + +def shufflenetv2(*args, **kwargs): + return ShuffleNetV2(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "shufflenetv2": + return ShuffleNetV2(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/squeezenet/mindspore_hub_conf.py b/model_zoo/official/cv/squeezenet/mindspore_hub_conf.py new file mode 100644 index 00000000000..26731287dfe --- /dev/null +++ b/model_zoo/official/cv/squeezenet/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.squeezenet import SqueezeNet + +def squeezenet(*args, **kwargs): + return SqueezeNet(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "squeezenet": + return SqueezeNet(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/cv/xception/mindspore_hub_conf.py b/model_zoo/official/cv/xception/mindspore_hub_conf.py new file mode 100644 index 00000000000..094b4eddabc --- /dev/null +++ b/model_zoo/official/cv/xception/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.Xception import xception + +def xceptionnet(*args, **kwargs): + return xception(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "xception": + return xception(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/nlp/fasttext/mindspore_hub_conf.py b/model_zoo/official/nlp/fasttext/mindspore_hub_conf.py new file mode 100644 index 00000000000..be9ca0acfd2 --- /dev/null +++ b/model_zoo/official/nlp/fasttext/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.fasttext_model import FastText + +def fasttext(*args, **kwargs): + return FastText(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "fasttext": + return FastText(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/nlp/mass/src/__init__.py b/model_zoo/official/nlp/mass/src/__init__.py index 7e943365a00..578d1392ac1 100644 --- a/model_zoo/official/nlp/mass/src/__init__.py +++ b/model_zoo/official/nlp/mass/src/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ from .transformer import LabelSmoothedCrossEntropyCriterion from .transformer import TransformerTrainOneStepWithLossScaleCell from .transformer import TransformerTraining from .transformer import infer +from .transformer import TransformerInferModel from .language_model import LooseMaskedLanguageModel from .language_model import MaskedLanguageModel from .language_model import NoiseChannelLanguageModel @@ -40,5 +41,6 @@ __all__ = [ "LabelSmoothedCrossEntropyCriterion", "LooseMaskedLanguageModel", "MaskedLanguageModel", + "TransformerInferModel", "NoiseChannelLanguageModel" ] diff --git a/model_zoo/official/nlp/mass/src/transformer/__init__.py b/model_zoo/official/nlp/mass/src/transformer/__init__.py index 36db26d360b..8b1ad986b0b 100644 --- a/model_zoo/official/nlp/mass/src/transformer/__init__.py +++ b/model_zoo/official/nlp/mass/src/transformer/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2020 Huawei Technologies Co., Ltd +# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ from .beam_search import BeamSearchDecoder from .transformer_for_train import TransformerTraining, LabelSmoothedCrossEntropyCriterion, \ TransformerNetworkWithLoss, TransformerTrainOneStepWithLossScaleCell from .infer_mass import infer, infer_ppl +from .transformer_for_infer import TransformerInferModel __all__ = [ "infer", @@ -31,5 +32,6 @@ __all__ = [ "Transformer", "TransformerEncoder", "TransformerDecoder", - "BeamSearchDecoder" + "BeamSearchDecoder", + "TransformerInferModel" ] diff --git a/model_zoo/official/nlp/textcnn/mindspore_hub_conf.py b/model_zoo/official/nlp/textcnn/mindspore_hub_conf.py new file mode 100644 index 00000000000..546a6ef1f5c --- /dev/null +++ b/model_zoo/official/nlp/textcnn/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.textcnn import TextCNN + +def textcnn_net(*args, **kwargs): + return TextCNN(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "textcnn": + return TextCNN(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/official/recommend/ncf/mindspore_hub_conf.py b/model_zoo/official/recommend/ncf/mindspore_hub_conf.py new file mode 100644 index 00000000000..60fcedb4bde --- /dev/null +++ b/model_zoo/official/recommend/ncf/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.ncf import NCFModel + +def ncfnet(*args, **kwargs): + return NCFModel(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "ncf": + return NCFModel(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/research/audio/fcn-4/mindspore_hub_conf.py b/model_zoo/research/audio/fcn-4/mindspore_hub_conf.py new file mode 100644 index 00000000000..bf8e9324ee2 --- /dev/null +++ b/model_zoo/research/audio/fcn-4/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.musictagger import MusicTaggerCNN + +def fcn_4(*args, **kwargs): + return MusicTaggerCNN(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "fcn4": + return MusicTaggerCNN(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo") diff --git a/model_zoo/research/nlp/textrcnn/mindspore_hub_conf.py b/model_zoo/research/nlp/textrcnn/mindspore_hub_conf.py new file mode 100644 index 00000000000..13f1f5e70e9 --- /dev/null +++ b/model_zoo/research/nlp/textrcnn/mindspore_hub_conf.py @@ -0,0 +1,25 @@ +# Copyright 2021 Huawei Technologies Co., Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================ +"""hub config""" +from src.textrcnn import textrcnn + +def textrcnn_net(*args, **kwargs): + return textrcnn(*args, **kwargs) + + +def create_network(name, *args, **kwargs): + if name == "textrcnn": + return textrcnn(*args, **kwargs) + raise NotImplementedError(f"{name} is not implemented in the repo")