|
@@ -26,6 +26,13 @@ class TranslationTest(unittest.TestCase, DemoCompatibilityCheck): |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
|
|
|
def test_run_with_model_name_for_en2zh_base(self): |
|
|
|
|
|
model_id = 'damo/nlp_csanmt_translation_en2zh_base' |
|
|
|
|
|
inputs = 'Elon Musk, co-founder and chief executive officer of Tesla Motors.' |
|
|
|
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
|
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
def test_run_with_model_name_for_en2fr(self): |
|
|
def test_run_with_model_name_for_en2fr(self): |
|
|
model_id = 'damo/nlp_csanmt_translation_en2fr' |
|
|
model_id = 'damo/nlp_csanmt_translation_en2fr' |
|
@@ -33,6 +40,13 @@ class TranslationTest(unittest.TestCase, DemoCompatibilityCheck): |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
|
|
|
def test_run_with_model_name_for_en2es(self): |
|
|
|
|
|
model_id = 'damo/nlp_csanmt_translation_en2es' |
|
|
|
|
|
inputs = 'When I was in my 20s, I saw my very first psychotherapy client.' |
|
|
|
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
|
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
def test_run_with_model_name_for_fr2en(self): |
|
|
def test_run_with_model_name_for_fr2en(self): |
|
|
model_id = 'damo/nlp_csanmt_translation_fr2en' |
|
|
model_id = 'damo/nlp_csanmt_translation_fr2en' |
|
@@ -40,6 +54,13 @@ class TranslationTest(unittest.TestCase, DemoCompatibilityCheck): |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level') |
|
|
|
|
|
def test_run_with_model_name_for_es2en(self): |
|
|
|
|
|
model_id = 'damo/nlp_csanmt_translation_es2en' |
|
|
|
|
|
inputs = 'Los físicos clasifican las partículas en dos categorías.' |
|
|
|
|
|
pipeline_ins = pipeline(self.task, model=model_id) |
|
|
|
|
|
print(pipeline_ins(input=inputs)) |
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 2, 'skip test in current test level') |
|
|
@unittest.skipUnless(test_level() >= 2, 'skip test in current test level') |
|
|
def test_run_with_default_model(self): |
|
|
def test_run_with_default_model(self): |
|
|
inputs = '声明补充说,沃伦的同事都深感震惊,并且希望他能够投案自首。' |
|
|
inputs = '声明补充说,沃伦的同事都深感震惊,并且希望他能够投案自首。' |
|
|