Skip to content

Commit 679c18c

Browse files
committed
test_wrong_model
1 parent 185a78f commit 679c18c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/pipelines/test_pipelines.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,17 @@ def test_pipe_same_device_id_offload(self):
18021802
sd.maybe_free_model_hooks()
18031803
assert sd._offload_gpu_id == 5
18041804

1805+
def test_wrong_model(self):
1806+
tokenizer = CLIPTokenizer.from_pretrained("hf-internal-testing/tiny-random-clip")
1807+
with self.assertRaises(ValueError) as error_context:
1808+
_ = StableDiffusionPipeline.from_pretrained(
1809+
"hf-internal-testing/diffusers-stable-diffusion-tiny-all", text_encoder=tokenizer
1810+
)
1811+
1812+
assert "Expected" in str(error_context.exception)
1813+
assert "text_encoder" in str(error_context.exception)
1814+
assert "CLIPTokenizer" in str(error_context.exception)
1815+
18051816

18061817
@slow
18071818
@require_torch_gpu

0 commit comments

Comments
 (0)