MCPcopy
hub / github.com/huggingface/diffusers / test_quality

Method test_quality

tests/quantization/bnb/test_4bit.py:476–488  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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"""

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected