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_unifold.py 1.4 kB

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.hub.snapshot_download import snapshot_download
  4. from modelscope.pipelines import pipeline
  5. from modelscope.utils.constant import Tasks
  6. from modelscope.utils.demo_utils import DemoCompatibilityCheck
  7. from modelscope.utils.test_utils import test_level
  8. class UnifoldProteinStructureTest(unittest.TestCase, DemoCompatibilityCheck):
  9. def setUp(self) -> None:
  10. self.task = Tasks.protein_structure
  11. self.model_id = 'DPTech/uni-fold-monomer'
  12. self.model_id_multimer = 'DPTech/uni-fold-multimer'
  13. self.protein = 'MGLPKKALKESQLQFLTAGTAVSDSSHQTYKVSFIENGVIKNAFYKKLDPKNHYPELLAKISVAVSLFKRIFQGRRSAEERLVFDD'
  14. self.protein_multimer = 'GAMGLPEEPSSPQESTLKALSLYEAHLSSYIMYLQTFLVKTKQKVNNKNYPEFTLFDTSKLKKDQTLKSIKT' + \
  15. 'NIAALKNHIDKIKPIAMQIYKKYSKNIP'
  16. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  17. def test_run_by_direct_model_download(self):
  18. model_dir = snapshot_download(self.model_id)
  19. mono_pipeline_ins = pipeline(task=self.task, model=model_dir)
  20. _ = mono_pipeline_ins(self.protein)
  21. model_dir1 = snapshot_download(self.model_id_multimer)
  22. multi_pipeline_ins = pipeline(task=self.task, model=model_dir1)
  23. _ = multi_pipeline_ins(self.protein_multimer)
  24. if __name__ == '__main__':
  25. unittest.main()