You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_automatic_post_editing.py 1.3 kB

123456789101112131415161718192021222324252627282930
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.pipelines import pipeline
  4. from modelscope.utils.constant import Tasks
  5. from modelscope.utils.demo_utils import DemoCompatibilityCheck
  6. from modelscope.utils.test_utils import test_level
  7. class AutomaticPostEditingTest(unittest.TestCase, DemoCompatibilityCheck):
  8. def setUp(self) -> None:
  9. self.task = Tasks.translation
  10. self.model_id = 'damo/nlp_automatic_post_editing_for_translation_en2de'
  11. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  12. def test_run_with_model_name_for_en2de(self):
  13. inputs = 'Simultaneously, the Legion took part to the pacification of Algeria, plagued by various tribal ' \
  14. 'rebellions and razzias.\005Gleichzeitig nahm die Legion an der Befriedung Algeriens teil, die von ' \
  15. 'verschiedenen Stammesaufständen und Rasias heimgesucht wurde.'
  16. pipeline_ins = pipeline(self.task, model=self.model_id)
  17. print(pipeline_ins(input=inputs))
  18. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  19. def test_demo_compatibility(self):
  20. self.compatibility_check()
  21. if __name__ == '__main__':
  22. unittest.main()