Browse Source

dialog modeling ready

master
ly119399 4 years ago
parent
commit
c99f3a9b8c
2 changed files with 5 additions and 6 deletions
  1. +1
    -1
      modelscope/utils/constant.py
  2. +4
    -5
      tests/pipelines/nlp/test_dialog_modeling.py

+ 1
- 1
modelscope/utils/constant.py View File

@@ -38,7 +38,7 @@ class Tasks(object):
token_classification = 'token-classification' token_classification = 'token-classification'
conversational = 'conversational' conversational = 'conversational'
text_generation = 'text-generation' text_generation = 'text-generation'
dialog_modeling = 'dialog_modeling'
dialog_modeling = 'dialog-modeling'
dialog_intent_prediction = 'dialog-intent-prediction' dialog_intent_prediction = 'dialog-intent-prediction'
table_question_answering = 'table-question-answering' table_question_answering = 'table-question-answering'
feature_extraction = 'feature-extraction' feature_extraction = 'feature-extraction'


+ 4
- 5
tests/pipelines/nlp/test_dialog_modeling.py View File

@@ -92,10 +92,9 @@ class DialogModelingTest(unittest.TestCase):
} }
} }


# @unittest.skip('test with snapshot_download')
@unittest.skip('test with snapshot_download')
def test_run(self): def test_run(self):


# cache_path = '/Users/yangliu/Space/maas_model/nlp_space_dialog-modeling'
cache_path = snapshot_download(self.model_id) cache_path = snapshot_download(self.model_id)


preprocessor = DialogModelingPreprocessor(model_dir=cache_path) preprocessor = DialogModelingPreprocessor(model_dir=cache_path)
@@ -124,12 +123,12 @@ class DialogModelingTest(unittest.TestCase):


def test_run_with_model_from_modelhub(self): def test_run_with_model_from_modelhub(self):
model = Model.from_pretrained(self.model_id) model = Model.from_pretrained(self.model_id)
preprocessor = DialogGenerationPreprocessor(model_dir=model.model_dir)
preprocessor = DialogModelingPreprocessor(model_dir=model.model_dir)


pipelines = [ pipelines = [
DialogGenerationPipeline(model=model, preprocessor=preprocessor),
DialogModelingPipeline(model=model, preprocessor=preprocessor),
pipeline( pipeline(
task=Tasks.dialog_generation,
task=Tasks.dialog_modeling,
model=model, model=model,
preprocessor=preprocessor) preprocessor=preprocessor)
] ]


Loading…
Cancel
Save