2022-10-25 22:59:19 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.hub.snapshot_download import snapshot_download
|
|
|
|
|
from modelscope.pipelines import pipeline
|
|
|
|
|
from modelscope.utils.constant import Tasks
|
|
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
2023-05-22 10:53:18 +08:00
|
|
|
class UnifoldProteinStructureTest(unittest.TestCase):
|
2022-10-25 22:59:19 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
|
self.task = Tasks.protein_structure
|
|
|
|
|
self.model_id = 'DPTech/uni-fold-monomer'
|
|
|
|
|
self.model_id_multimer = 'DPTech/uni-fold-multimer'
|
|
|
|
|
|
|
|
|
|
self.protein = 'MGLPKKALKESQLQFLTAGTAVSDSSHQTYKVSFIENGVIKNAFYKKLDPKNHYPELLAKISVAVSLFKRIFQGRRSAEERLVFDD'
|
|
|
|
|
self.protein_multimer = 'GAMGLPEEPSSPQESTLKALSLYEAHLSSYIMYLQTFLVKTKQKVNNKNYPEFTLFDTSKLKKDQTLKSIKT' + \
|
2022-12-13 14:18:39 +08:00
|
|
|
'NIAALKNHIDKIKPIAMQIYKKYSKNIP NIAALKNHIDKIKPIAMQIYKKYSKNIP'
|
2022-10-25 22:59:19 +08:00
|
|
|
|
2023-01-09 06:56:30 +08:00
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
|
2022-10-25 22:59:19 +08:00
|
|
|
def test_run_by_direct_model_download(self):
|
|
|
|
|
model_dir1 = snapshot_download(self.model_id_multimer)
|
|
|
|
|
multi_pipeline_ins = pipeline(task=self.task, model=model_dir1)
|
|
|
|
|
_ = multi_pipeline_ins(self.protein_multimer)
|
|
|
|
|
|
2022-12-13 14:18:39 +08:00
|
|
|
model_dir = snapshot_download(self.model_id)
|
|
|
|
|
mono_pipeline_ins = pipeline(task=self.task, model=model_dir)
|
|
|
|
|
_ = mono_pipeline_ins(self.protein)
|
|
|
|
|
|
2022-10-25 22:59:19 +08:00
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|