| @@ -16,6 +16,7 @@ class Models(object): | |||||
| palm = 'palm-v2' | palm = 'palm-v2' | ||||
| structbert = 'structbert' | structbert = 'structbert' | ||||
| veco = 'veco' | veco = 'veco' | ||||
| space = 'space' | |||||
| # audio models | # audio models | ||||
| sambert_hifi_16k = 'sambert-hifi-16k' | sambert_hifi_16k = 'sambert-hifi-16k' | ||||
| @@ -98,6 +99,8 @@ class Preprocessors(object): | |||||
| token_cls_tokenizer = 'token-cls-tokenizer' | token_cls_tokenizer = 'token-cls-tokenizer' | ||||
| nli_tokenizer = 'nli-tokenizer' | nli_tokenizer = 'nli-tokenizer' | ||||
| sen_cls_tokenizer = 'sen-cls-tokenizer' | sen_cls_tokenizer = 'sen-cls-tokenizer' | ||||
| dialog_intent_preprocessor = 'dialog-intent-preprocessor' | |||||
| dialog_modeling_preprocessor = 'dialog-modeling-preprocessor' | |||||
| # audio preprocessor | # audio preprocessor | ||||
| linear_aec_fbank = 'linear-aec-fbank' | linear_aec_fbank = 'linear-aec-fbank' | ||||
| @@ -1,6 +1,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict | from typing import Any, Dict | ||||
| from ....metainfo import Models | |||||
| from ....preprocessors.space.fields.intent_field import IntentBPETextField | from ....preprocessors.space.fields.intent_field import IntentBPETextField | ||||
| from ....trainers.nlp.space.trainer.intent_trainer import IntentTrainer | from ....trainers.nlp.space.trainer.intent_trainer import IntentTrainer | ||||
| from ....utils.config import Config | from ....utils.config import Config | ||||
| @@ -13,7 +14,8 @@ from .model.model_base import SpaceModelBase | |||||
| __all__ = ['SpaceForDialogIntentModel'] | __all__ = ['SpaceForDialogIntentModel'] | ||||
| @MODELS.register_module(Tasks.dialog_intent_prediction, module_name=r'space') | |||||
| @MODELS.register_module( | |||||
| Tasks.dialog_intent_prediction, module_name=Models.space) | |||||
| class SpaceForDialogIntentModel(Model): | class SpaceForDialogIntentModel(Model): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||
| @@ -1,6 +1,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict, Optional | from typing import Any, Dict, Optional | ||||
| from ....metainfo import Models | |||||
| from ....preprocessors.space.fields.gen_field import MultiWOZBPETextField | from ....preprocessors.space.fields.gen_field import MultiWOZBPETextField | ||||
| from ....trainers.nlp.space.trainer.gen_trainer import MultiWOZTrainer | from ....trainers.nlp.space.trainer.gen_trainer import MultiWOZTrainer | ||||
| from ....utils.config import Config | from ....utils.config import Config | ||||
| @@ -13,7 +14,7 @@ from .model.model_base import SpaceModelBase | |||||
| __all__ = ['SpaceForDialogModelingModel'] | __all__ = ['SpaceForDialogModelingModel'] | ||||
| @MODELS.register_module(Tasks.dialog_modeling, module_name=r'space') | |||||
| @MODELS.register_module(Tasks.dialog_modeling, module_name=Models.space) | |||||
| class SpaceForDialogModelingModel(Model): | class SpaceForDialogModelingModel(Model): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||
| @@ -3,6 +3,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict | from typing import Any, Dict | ||||
| from ...metainfo import Preprocessors | |||||
| from ...utils.config import Config | from ...utils.config import Config | ||||
| from ...utils.constant import Fields, ModelFile | from ...utils.constant import Fields, ModelFile | ||||
| from ...utils.type_assert import type_assert | from ...utils.type_assert import type_assert | ||||
| @@ -13,7 +14,8 @@ from .fields.intent_field import IntentBPETextField | |||||
| __all__ = ['DialogIntentPredictionPreprocessor'] | __all__ = ['DialogIntentPredictionPreprocessor'] | ||||
| @PREPROCESSORS.register_module(Fields.nlp, module_name=r'space-intent') | |||||
| @PREPROCESSORS.register_module( | |||||
| Fields.nlp, module_name=Preprocessors.dialog_intent_preprocessor) | |||||
| class DialogIntentPredictionPreprocessor(Preprocessor): | class DialogIntentPredictionPreprocessor(Preprocessor): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||
| @@ -3,6 +3,7 @@ | |||||
| import os | import os | ||||
| from typing import Any, Dict | from typing import Any, Dict | ||||
| from ...metainfo import Preprocessors | |||||
| from ...utils.config import Config | from ...utils.config import Config | ||||
| from ...utils.constant import Fields, ModelFile | from ...utils.constant import Fields, ModelFile | ||||
| from ...utils.type_assert import type_assert | from ...utils.type_assert import type_assert | ||||
| @@ -13,7 +14,8 @@ from .fields.gen_field import MultiWOZBPETextField | |||||
| __all__ = ['DialogModelingPreprocessor'] | __all__ = ['DialogModelingPreprocessor'] | ||||
| @PREPROCESSORS.register_module(Fields.nlp, module_name=r'space-modeling') | |||||
| @PREPROCESSORS.register_module( | |||||
| Fields.nlp, module_name=Preprocessors.dialog_modeling_preprocessor) | |||||
| class DialogModelingPreprocessor(Preprocessor): | class DialogModelingPreprocessor(Preprocessor): | ||||
| def __init__(self, model_dir: str, *args, **kwargs): | def __init__(self, model_dir: str, *args, **kwargs): | ||||