2022-08-05 23:48:46 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.trainers.nlp import CsanmtTranslationTrainer
|
|
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TranslationTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
2022-11-14 20:31:29 +08:00
|
|
|
def test_run_with_model_name_for_en2zh(self):
|
|
|
|
|
model_id = 'damo/nlp_csanmt_translation_en2zh'
|
|
|
|
|
trainer = CsanmtTranslationTrainer(model=model_id)
|
|
|
|
|
trainer.train()
|
|
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
|
|
|
def test_run_with_model_name_for_en2fr(self):
|
|
|
|
|
model_id = 'damo/nlp_csanmt_translation_en2fr'
|
|
|
|
|
trainer = CsanmtTranslationTrainer(model=model_id)
|
2022-08-05 23:48:46 +08:00
|
|
|
trainer.train()
|
|
|
|
|
|
2022-11-29 13:44:06 +08:00
|
|
|
@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'
|
|
|
|
|
trainer = CsanmtTranslationTrainer(model=model_id)
|
|
|
|
|
trainer.train()
|
|
|
|
|
|
2022-08-05 23:48:46 +08:00
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|