Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/models/autoencoders/test_models_autoencoder_kl.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ def get_dummy_inputs(self):


class TestAutoencoderKL(AutoencoderKLTesterConfig, ModelTesterMixin, TrainingTesterMixin):
@pytest.mark.parametrize("dtype", [torch.float16, torch.bfloat16], ids=["fp16", "bf16"])
def test_from_save_pretrained_dtype_inference(self, tmp_path, dtype):
# The reference and reloaded models hold identical weights, so any output difference is
# half-precision kernel nondeterminism between the two module instances rather than a save/load
# fidelity issue. The default 1e-4 tolerance is too tight for that fp16/bf16 noise on some GPUs.
super().test_from_save_pretrained_dtype_inference(tmp_path, dtype, atol=1e-3)

def test_gradient_checkpointing_is_applied(self):
expected_set = {"Decoder", "Encoder", "UNetMidBlock2D"}
super().test_gradient_checkpointing_is_applied(expected_set=expected_set)
Expand Down
Loading