(self)
| 379 | release_memory(pipe) |
| 380 | |
| 381 | def test_a1111(self): |
| 382 | generator = torch.Generator().manual_seed(0) |
| 383 | |
| 384 | pipe = StableDiffusionPipeline.from_pretrained("hf-internal-testing/Counterfeit-V2.5", safety_checker=None).to( |
| 385 | torch_device |
| 386 | ) |
| 387 | lora_model_id = "hf-internal-testing/civitai-light-shadow-lora" |
| 388 | lora_filename = "light_and_shadow.safetensors" |
| 389 | pipe.load_lora_weights(lora_model_id, weight_name=lora_filename) |
| 390 | |
| 391 | images = pipe( |
| 392 | "masterpiece, best quality, mountain", output_type="np", generator=generator, num_inference_steps=2 |
| 393 | ).images |
| 394 | |
| 395 | images = images[0, -3:, -3:, -1].flatten() |
| 396 | expected = np.array([0.3636, 0.3708, 0.3694, 0.3679, 0.3829, 0.3677, 0.3692, 0.3688, 0.3292]) |
| 397 | |
| 398 | max_diff = numpy_cosine_similarity_distance(expected, images) |
| 399 | assert max_diff < 1e-3 |
| 400 | |
| 401 | pipe.unload_lora_weights() |
| 402 | release_memory(pipe) |
| 403 | |
| 404 | def test_lycoris(self): |
| 405 | generator = torch.Generator().manual_seed(0) |
nothing calls this directly
no test coverage detected