(self)
| 474 | backend_empty_cache(torch_device) |
| 475 | |
| 476 | def test_quality(self): |
| 477 | output = self.pipeline_4bit( |
| 478 | prompt=self.prompt, |
| 479 | num_inference_steps=self.num_inference_steps, |
| 480 | generator=torch.manual_seed(self.seed), |
| 481 | output_type="np", |
| 482 | ).images |
| 483 | |
| 484 | out_slice = output[0, -3:, -3:, -1].flatten() |
| 485 | expected_slice = np.array([0.1123, 0.1296, 0.1609, 0.1042, 0.1230, 0.1274, 0.0928, 0.1165, 0.1216]) |
| 486 | |
| 487 | max_diff = numpy_cosine_similarity_distance(expected_slice, out_slice) |
| 488 | self.assertTrue(max_diff < 1e-2) |
| 489 | |
| 490 | def test_generate_quality_dequantize(self): |
| 491 | r""" |
nothing calls this directly
no test coverage detected