Skip to content

Commit

Permalink
disable lpw tests on tiny models
Browse files Browse the repository at this point in the history
  • Loading branch information
noskill committed Jul 22, 2024
1 parent 9e3de39 commit 157ab8b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/pipe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ def compute_diff(self, im1: PIL.Image.Image, im2: PIL.Image.Image) -> float:



def can_run_lpw():
if os.environ.get('METAFUSION_MODELS_DIR'):
return True
return False


class MyTestCase(TestCase):

def setUp(self):
self._pipeline = None

def get_model(self):
models_dir = os.environ.get('METAFUSION_MODELS_DIR', None)
if models_dir is not None:
return models_dir + '/icb_diffusers'
return "hf-internal-testing/tiny-stable-diffusion-torch"

def get_ref_image(self):
Expand Down Expand Up @@ -116,6 +125,7 @@ def test_img2img_basic(self):
result = pipe.gen(dict(prompt="cube planet cartoon style"))
result.save('test_img2img_basic.png')

@unittest.skipIf(not can_run_lpw(), "can't run on tiny version of SD")
def test_lpw(self):
"""
Check that last part of long prompt affect the generation
Expand All @@ -138,6 +148,7 @@ def test_lpw(self):
# check that difference is large
self.assertGreater(diff, 1000)

@unittest.skipIf(not can_run_lpw(), "can't run on tiny version of SD")
def test_lpw_turned_off(self):
"""
Check that last part of long prompt don't affect the generation with lpw turned off
Expand All @@ -164,6 +175,9 @@ def test_lpw_turned_off(self):
class TestSDXL(MyTestCase):

def get_model(self):
models_dir = os.environ.get('METAFUSION_MODELS_DIR', None)
if models_dir is not None:
return models_dir + '/SDXL/stable-diffusion-xl-base-1.0'
return "hf-internal-testing/tiny-stable-diffusion-xl-pipe"


Expand Down

0 comments on commit 157ab8b

Please sign in to comment.