| @@ -47,10 +47,12 @@ class Pipelines(object): | |||||
| word_segmentation = 'word-segmentation' | word_segmentation = 'word-segmentation' | ||||
| text_generation = 'text-generation' | text_generation = 'text-generation' | ||||
| sentiment_analysis = 'sentiment-analysis' | sentiment_analysis = 'sentiment-analysis' | ||||
| sentiment_classification = "sentiment-classification" | |||||
| zero_shot_classification = "zero-shot-classification" | |||||
| fill_mask = "fill-mask" | |||||
| nli = "nli" | |||||
| sentiment_classification = 'sentiment-classification' | |||||
| zero_shot_classification = 'zero-shot-classification' | |||||
| fill_mask = 'fill-mask' | |||||
| nli = 'nli' | |||||
| dialog_intent_prediction = 'dialog-intent-prediction' | |||||
| dialog_modeling = 'dialog-modeling' | |||||
| # audio tasks | # audio tasks | ||||
| sambert_hifigan_16k_tts = 'sambert-hifigan-16k-tts' | sambert_hifigan_16k_tts = 'sambert-hifigan-16k-tts' | ||||
| @@ -1,8 +1,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict | from typing import Any, Dict | ||||
| from ....preprocessors.space.fields.intent_field import \ | |||||
| IntentBPETextField | |||||
| from ....preprocessors.space.fields.intent_field import IntentBPETextField | |||||
| from ....trainers.nlp.space.trainers.intent_trainer import IntentTrainer | from ....trainers.nlp.space.trainers.intent_trainer import IntentTrainer | ||||
| from ....utils.config import Config | from ....utils.config import Config | ||||
| from ....utils.constant import Tasks | from ....utils.constant import Tasks | ||||
| @@ -14,8 +13,7 @@ from .model.model_base import ModelBase | |||||
| __all__ = ['DialogIntentModel'] | __all__ = ['DialogIntentModel'] | ||||
| @MODELS.register_module( | |||||
| Tasks.dialog_intent_prediction, module_name=r'space-intent') | |||||
| @MODELS.register_module(Tasks.dialog_intent_prediction, module_name=r'space') | |||||
| class DialogIntentModel(Model): | class DialogIntentModel(Model): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||
| @@ -1,8 +1,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict, Optional | from typing import Any, Dict, Optional | ||||
| from ....preprocessors.space.fields.gen_field import \ | |||||
| MultiWOZBPETextField | |||||
| from ....preprocessors.space.fields.gen_field import MultiWOZBPETextField | |||||
| from ....trainers.nlp.space.trainers.gen_trainer import MultiWOZTrainer | from ....trainers.nlp.space.trainers.gen_trainer import MultiWOZTrainer | ||||
| from ....utils.config import Config | from ....utils.config import Config | ||||
| from ....utils.constant import Tasks | from ....utils.constant import Tasks | ||||
| @@ -14,7 +13,7 @@ from .model.model_base import ModelBase | |||||
| __all__ = ['DialogModelingModel'] | __all__ = ['DialogModelingModel'] | ||||
| @MODELS.register_module(Tasks.dialog_modeling, module_name=r'space-modeling') | |||||
| @MODELS.register_module(Tasks.dialog_modeling, module_name=r'space') | |||||
| class DialogModelingModel(Model): | class DialogModelingModel(Model): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||
| @@ -4,4 +4,3 @@ from .builder import pipeline | |||||
| from .cv import * # noqa F403 | from .cv import * # noqa F403 | ||||
| from .multi_modal import * # noqa F403 | from .multi_modal import * # noqa F403 | ||||
| from .nlp import * # noqa F403 | from .nlp import * # noqa F403 | ||||
| from .nlp.space import * # noqa F403 | |||||
| @@ -25,8 +25,7 @@ DEFAULT_MODEL_FOR_PIPELINE = { | |||||
| (Pipelines.sentence_similarity, | (Pipelines.sentence_similarity, | ||||
| 'damo/nlp_structbert_sentence-similarity_chinese-base'), | 'damo/nlp_structbert_sentence-similarity_chinese-base'), | ||||
| Tasks.image_matting: ('image-matting', 'damo/cv_unet_image-matting'), | Tasks.image_matting: ('image-matting', 'damo/cv_unet_image-matting'), | ||||
| Tasks.nli: (Pipelines.nli, | |||||
| 'damo/nlp_structbert_nli_chinese-base'), | |||||
| Tasks.nli: (Pipelines.nli, 'damo/nlp_structbert_nli_chinese-base'), | |||||
| Tasks.sentiment_classification: | Tasks.sentiment_classification: | ||||
| (Pipelines.sentiment_classification, | (Pipelines.sentiment_classification, | ||||
| 'damo/nlp_structbert_sentiment-classification_chinese-base'), | 'damo/nlp_structbert_sentiment-classification_chinese-base'), | ||||
| @@ -48,7 +47,7 @@ DEFAULT_MODEL_FOR_PIPELINE = { | |||||
| 'damo/cv_unet_person-image-cartoon_compound-models'), | 'damo/cv_unet_person-image-cartoon_compound-models'), | ||||
| Tasks.ocr_detection: (Pipelines.ocr_detection, | Tasks.ocr_detection: (Pipelines.ocr_detection, | ||||
| 'damo/cv_resnet18_ocr-detection-line-level_damo'), | 'damo/cv_resnet18_ocr-detection-line-level_damo'), | ||||
| Tasks.fill_mask: (Pipelines.fill_mask, 'damo/nlp_veco_fill-mask_large') | |||||
| Tasks.fill_mask: (Pipelines.fill_mask, 'damo/nlp_veco_fill-mask_large'), | |||||
| Tasks.action_recognition: (Pipelines.action_recognition, | Tasks.action_recognition: (Pipelines.action_recognition, | ||||
| 'damo/cv_TAdaConv_action-recognition'), | 'damo/cv_TAdaConv_action-recognition'), | ||||
| } | } | ||||
| @@ -1,10 +1,10 @@ | |||||
| from .dialog_intent_prediction_pipeline import * # noqa F403 | |||||
| from .dialog_modeling_pipeline import * # noqa F403 | |||||
| from .fill_mask_pipeline import * # noqa F403 | from .fill_mask_pipeline import * # noqa F403 | ||||
| from .nli_pipeline import * # noqa F403 | from .nli_pipeline import * # noqa F403 | ||||
| from .sentence_similarity_pipeline import * # noqa F403 | from .sentence_similarity_pipeline import * # noqa F403 | ||||
| from .sentiment_classification_pipeline import * # noqa F403 | from .sentiment_classification_pipeline import * # noqa F403 | ||||
| from .sequence_classification_pipeline import * # noqa F403 | from .sequence_classification_pipeline import * # noqa F403 | ||||
| from .space.dialog_intent_prediction_pipeline import * # noqa F403 | |||||
| from .space.dialog_modeling_pipeline import * # noqa F403 | |||||
| from .text_generation_pipeline import * # noqa F403 | from .text_generation_pipeline import * # noqa F403 | ||||
| from .word_segmentation_pipeline import * # noqa F403 | from .word_segmentation_pipeline import * # noqa F403 | ||||
| from .zero_shot_classification_pipeline import * # noqa F403 | from .zero_shot_classification_pipeline import * # noqa F403 | ||||
| @@ -1,16 +1,18 @@ | |||||
| from typing import Any, Dict | from typing import Any, Dict | ||||
| from ...base import Pipeline | |||||
| from ...builder import PIPELINES | |||||
| from ....models.nlp import DialogIntentModel | |||||
| from ....preprocessors import DialogIntentPredictionPreprocessor | |||||
| from ....utils.constant import Tasks | |||||
| from ...metainfo import Pipelines | |||||
| from ...models.nlp import DialogIntentModel | |||||
| from ...preprocessors import DialogIntentPredictionPreprocessor | |||||
| from ...utils.constant import Tasks | |||||
| from ..base import Pipeline | |||||
| from ..builder import PIPELINES | |||||
| __all__ = ['DialogIntentPredictionPipeline'] | __all__ = ['DialogIntentPredictionPipeline'] | ||||
| @PIPELINES.register_module( | @PIPELINES.register_module( | ||||
| Tasks.dialog_intent_prediction, module_name=r'space-intent') | |||||
| Tasks.dialog_intent_prediction, | |||||
| module_name=Pipelines.dialog_intent_prediction) | |||||
| class DialogIntentPredictionPipeline(Pipeline): | class DialogIntentPredictionPipeline(Pipeline): | ||||
| def __init__(self, model: DialogIntentModel, | def __init__(self, model: DialogIntentModel, | ||||
| @@ -3,14 +3,15 @@ from typing import Any, Dict, Optional | |||||
| from modelscope.models.nlp import DialogModelingModel | from modelscope.models.nlp import DialogModelingModel | ||||
| from modelscope.preprocessors import DialogModelingPreprocessor | from modelscope.preprocessors import DialogModelingPreprocessor | ||||
| from modelscope.utils.constant import Tasks | from modelscope.utils.constant import Tasks | ||||
| from ...base import Pipeline, Tensor | |||||
| from ...builder import PIPELINES | |||||
| from ...metainfo import Pipelines | |||||
| from ..base import Pipeline, Tensor | |||||
| from ..builder import PIPELINES | |||||
| __all__ = ['DialogModelingPipeline'] | __all__ = ['DialogModelingPipeline'] | ||||
| @PIPELINES.register_module( | @PIPELINES.register_module( | ||||
| Tasks.dialog_modeling, module_name=r'space-modeling') | |||||
| Tasks.dialog_modeling, module_name=Pipelines.dialog_modeling) | |||||
| class DialogModelingPipeline(Pipeline): | class DialogModelingPipeline(Pipeline): | ||||
| def __init__(self, model: DialogModelingModel, | def __init__(self, model: DialogModelingModel, | ||||