mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-24 03:59:23 +01:00
23 lines
750 B
Python
23 lines
750 B
Python
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
||
|
|
import shutil
|
||
|
|
import unittest
|
||
|
|
|
||
|
|
from modelscope.hub.snapshot_download import snapshot_download
|
||
|
|
from modelscope.pipelines import TranslationPipeline, pipeline
|
||
|
|
from modelscope.utils.constant import Tasks
|
||
|
|
from modelscope.utils.test_utils import test_level
|
||
|
|
|
||
|
|
|
||
|
|
class TranslationTest(unittest.TestCase):
|
||
|
|
model_id = 'damo/nlp_csanmt_translation'
|
||
|
|
inputs = 'Gut@@ ach : Incre@@ ased safety for pedestri@@ ans'
|
||
|
|
|
||
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
||
|
|
def test_run_with_model_name(self):
|
||
|
|
pipeline_ins = pipeline(task=Tasks.translation, model=self.model_id)
|
||
|
|
print(pipeline_ins(input=self.inputs))
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
unittest.main()
|