mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 20:19:51 +01:00
1. Merge(add) daily regression from github PR (daily_regression.yaml) 2. Add lora stable diffusion from github PR Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13010802 * fix: device arg not work, rename device to ngpu (#272) * Correcting the lora stable diffusion example script (#300) * add vad model and punc model in README.md add vad model and punc model * Merge pull request #302 from modelscope/langgz-patch-1 add vad model and punc model in README.md * add 1.6 * modify ignore * Merge pull request #307 from modelscope/dev_rs_16 Merge release 1.6 * undo datetime to 2099 * Merge pull request #311 from modelscope/fix_master_version undo datetime to 2099 * add daily regression workflow * modify workflow name * fix cron format issue * lora trainer * Merge pull request #315 from liuyhwangyh/add_regression_workflow add daily regression workflow
34 lines
955 B
Python
34 lines
955 B
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
import unittest
|
|
|
|
import cv2
|
|
|
|
from modelscope.pipelines import pipeline
|
|
from modelscope.utils.constant import Tasks
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
class DiffusersStableDiffusionTest(unittest.TestCase):
|
|
|
|
def setUp(self) -> None:
|
|
self.task = Tasks.text_to_image_synthesis
|
|
self.model_id = 'shadescript/stable-diffusion-2-1-dev'
|
|
|
|
test_input = 'a photo of an astronaut riding a horse on mars'
|
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
|
|
def test_run(self):
|
|
diffusers_pipeline = pipeline(task=self.task, model=self.model_id)
|
|
output = diffusers_pipeline({
|
|
'prompt': self.test_input,
|
|
'height': 512,
|
|
'width': 512
|
|
})
|
|
cv2.imwrite('output.png', output['output_imgs'][0])
|
|
print('Image saved to output.png')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|