Browse Source

update dst

master
ly119399 3 years ago
parent
commit
d9cedf2632
5 changed files with 9 additions and 8 deletions
  1. +3
    -2
      modelscope/pipelines/__init__.py
  2. +1
    -1
      modelscope/pipelines/nlp/dialog_intent_prediction_pipeline.py
  3. +1
    -1
      modelscope/pipelines/nlp/dialog_modeling_pipeline.py
  4. +2
    -2
      modelscope/pipelines/outputs.py
  5. +2
    -2
      tests/pipelines/test_dialog_modeling.py

+ 3
- 2
modelscope/pipelines/__init__.py View File

@@ -1,6 +1,7 @@
# from .audio import LinearAECPipeline
# from .audio.ans_pipeline import ANSPipeline
from .audio import LinearAECPipeline
from .audio.ans_pipeline import ANSPipeline
from .base import Pipeline
from .builder import pipeline
from .cv import * # noqa F403
from .multi_modal import * # noqa F403
from .nlp import * # noqa F403

+ 1
- 1
modelscope/pipelines/nlp/dialog_intent_prediction_pipeline.py View File

@@ -44,7 +44,7 @@ class DialogIntentPredictionPipeline(Pipeline):
pos = np.where(pred == np.max(pred))

result = {
'pred': pred,
'prediction': pred,
'label_pos': pos[0],
'label': self.categories[pos[0][0]]
}


+ 1
- 1
modelscope/pipelines/nlp/dialog_modeling_pipeline.py View File

@@ -43,6 +43,6 @@ class DialogModelingPipeline(Pipeline):
assert len(sys_rsp) > 2
sys_rsp = sys_rsp[1:len(sys_rsp) - 1]

inputs['sys'] = sys_rsp
inputs['response'] = sys_rsp

return inputs

+ 2
- 2
modelscope/pipelines/outputs.py View File

@@ -178,10 +178,10 @@ TASK_OUTPUTS = {
# 4.31488479e-05, 4.94503947e-05, 4.30105974e-05, 1.00963116e-04,
# 2.82062047e-05, 1.15582036e-04, 4.48261271e-05, 3.99339879e-05,
# 7.27692823e-05], dtype=float32), 'label_pos': array([11]), 'label': 'lost_or_stolen_card'}
Tasks.dialog_intent_prediction: ['pred', 'label_pos', 'label'],
Tasks.dialog_intent_prediction: ['prediction', 'label_pos', 'label'],

# sys : ['you', 'are', 'welcome', '.', 'have', 'a', 'great', 'day', '!']
Tasks.dialog_modeling: ['sys'],
Tasks.dialog_modeling: ['response'],

# ============ audio tasks ===================



+ 2
- 2
tests/pipelines/test_dialog_modeling.py View File

@@ -116,7 +116,7 @@ class DialogModelingTest(unittest.TestCase):
'user_input': user,
'history': result
})
print('sys : {}'.format(result['sys']))
print('response : {}'.format(result['response']))

@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
def test_run_with_model_from_modelhub(self):
@@ -140,7 +140,7 @@ class DialogModelingTest(unittest.TestCase):
'user_input': user,
'history': result
})
print('sys : {}'.format(result['sys']))
print('response : {}'.format(result['response']))


if __name__ == '__main__':


Loading…
Cancel
Save