Browse Source

add space to metainfo

master
智丞 3 years ago
parent
commit
a1750095c9
5 changed files with 14 additions and 4 deletions
  1. +3
    -0
      modelscope/metainfo.py
  2. +3
    -1
      modelscope/models/nlp/space/dialog_intent_prediction_model.py
  3. +2
    -1
      modelscope/models/nlp/space/dialog_modeling_model.py
  4. +3
    -1
      modelscope/preprocessors/space/dialog_intent_prediction_preprocessor.py
  5. +3
    -1
      modelscope/preprocessors/space/dialog_modeling_preprocessor.py

+ 3
- 0
modelscope/metainfo.py View File

@@ -16,6 +16,7 @@ class Models(object):
palm = 'palm-v2'
structbert = 'structbert'
veco = 'veco'
space = 'space'

# audio models
sambert_hifi_16k = 'sambert-hifi-16k'
@@ -98,6 +99,8 @@ class Preprocessors(object):
token_cls_tokenizer = 'token-cls-tokenizer'
nli_tokenizer = 'nli-tokenizer'
sen_cls_tokenizer = 'sen-cls-tokenizer'
dialog_intent_preprocessor = 'dialog-intent-preprocessor'
dialog_modeling_preprocessor = 'dialog-modeling-preprocessor'

# audio preprocessor
linear_aec_fbank = 'linear-aec-fbank'


+ 3
- 1
modelscope/models/nlp/space/dialog_intent_prediction_model.py View File

@@ -1,6 +1,7 @@
import os
from typing import Any, Dict

from ....metainfo import Models
from ....preprocessors.space.fields.intent_field import IntentBPETextField
from ....trainers.nlp.space.trainer.intent_trainer import IntentTrainer
from ....utils.config import Config
@@ -13,7 +14,8 @@ from .model.model_base import SpaceModelBase
__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):

def __init__(self, model_dir: str, *args, **kwargs):


+ 2
- 1
modelscope/models/nlp/space/dialog_modeling_model.py View File

@@ -1,6 +1,7 @@
import os
from typing import Any, Dict, Optional

from ....metainfo import Models
from ....preprocessors.space.fields.gen_field import MultiWOZBPETextField
from ....trainers.nlp.space.trainer.gen_trainer import MultiWOZTrainer
from ....utils.config import Config
@@ -13,7 +14,7 @@ from .model.model_base import SpaceModelBase
__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):

def __init__(self, model_dir: str, *args, **kwargs):


+ 3
- 1
modelscope/preprocessors/space/dialog_intent_prediction_preprocessor.py View File

@@ -3,6 +3,7 @@
import os
from typing import Any, Dict

from ...metainfo import Preprocessors
from ...utils.config import Config
from ...utils.constant import Fields, ModelFile
from ...utils.type_assert import type_assert
@@ -13,7 +14,8 @@ from .fields.intent_field import IntentBPETextField
__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):

def __init__(self, model_dir: str, *args, **kwargs):


+ 3
- 1
modelscope/preprocessors/space/dialog_modeling_preprocessor.py View File

@@ -3,6 +3,7 @@
import os
from typing import Any, Dict

from ...metainfo import Preprocessors
from ...utils.config import Config
from ...utils.constant import Fields, ModelFile
from ...utils.type_assert import type_assert
@@ -13,7 +14,8 @@ from .fields.gen_field import MultiWOZBPETextField
__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):

def __init__(self, model_dir: str, *args, **kwargs):


Loading…
Cancel
Save