sample-datasets / text_outputs_single_file /test_model_vae_single_file_output.txt
sayakpaul's picture
sayakpaul HF staff
Upload folder using huggingface_hub
aa6ad2f verified
raw
history blame
No virus
2.53 kB
============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-8.2.0, pluggy-1.5.0
rootdir: /diffusers
configfile: pyproject.toml
plugins: xdist-3.6.1, timeout-2.3.1, requests-mock-1.10.0
collected 3 items
tests/single_file/test_model_vae_single_file.py ..F [100%]
=================================== FAILURES ===================================
__ AutoencoderKLSingleFileTests.test_single_file_inference_same_as_pretrained __
self = <tests.single_file.test_model_vae_single_file.AutoencoderKLSingleFileTests testMethod=test_single_file_inference_same_as_pretrained>
def test_single_file_inference_same_as_pretrained(self):
model_1 = self.model_class.from_pretrained(self.repo_id, subfolder="vae").to(torch_device)
model_2 = self.model_class.from_single_file(self.ckpt_path).to(torch_device)
image = self.get_sd_image(33)
with torch.no_grad():
sample_1 = model_1(image).sample
sample_2 = model_2(image).sample
assert sample_1.shape == sample_2.shape
output_slice_1 = sample_1[-1, -2:, -2:, :2].flatten().float().cpu()
output_slice_2 = sample_2[-1, -2:, -2:, :2].flatten().float().cpu()
> assert torch_all_close(output_slice_1, output_slice_2, atol=3e-3)
tests/single_file/test_model_vae_single_file.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = tensor([-0.1609, 0.9866, -0.0487, -0.0777, -0.2716, 0.8368, -0.2055, -0.0814])
b = tensor([-0.1320, -0.0016, 0.0303, 0.0990, -0.1214, -0.1188, -0.0463, -0.0008])
args = (), kwargs = {'atol': 0.003}
def torch_all_close(a, b, *args, **kwargs):
if not is_torch_available():
raise ValueError("PyTorch needs to be installed to use this function.")
if not torch.allclose(a, b, *args, **kwargs):
> assert False, f"Max diff is absolute {(a - b).abs().max()}. Diff tensor is {(a - b).abs()}."
E AssertionError: Max diff is absolute 0.9882212281227112. Diff tensor is tensor([0.0288, 0.9882, 0.0790, 0.1767, 0.1501, 0.9556, 0.1592, 0.0806]).
src/diffusers/utils/testing_utils.py:97: AssertionError
=========================== short test summary info ============================
FAILED tests/single_file/test_model_vae_single_file.py::AutoencoderKLSingleFileTests::test_single_file_inference_same_as_pretrained
========================= 1 failed, 2 passed in 17.25s =========================