fix: keep LDF transformer dtypes aligned

This commit is contained in:
2026-08-15 21:58:53 +02:00
parent eefbcbd9a2
commit 897e343268
2 changed files with 31 additions and 5 deletions
+25
View File
@@ -1,5 +1,6 @@
import torch
import pytest
from types import SimpleNamespace
from ldf_backend import LDFVFIModel
@@ -21,6 +22,15 @@ class _RecordingConditionalVAE:
return torch.zeros(1, 3, 40, 1, 1)
class _RecordingTransformer:
def __init__(self):
self.to_kwargs = None
def to(self, **kwargs):
self.to_kwargs = kwargs
return self
class _ShapeOnlyLDF(LDFVFIModel):
"""Exercise sequence chunking without loading the multi-GB checkpoint."""
@@ -80,6 +90,21 @@ def test_decode_tiles_40_frame_720p_condition_for_conditional_vae():
assert result.shape == (40, 3, 1, 1)
def test_device_move_casts_complete_ldf_transformer_to_bfloat16():
model = LDFVFIModel.__new__(LDFVFIModel)
transformer = _RecordingTransformer()
model.model = SimpleNamespace(transformer=transformer)
model.dtype = torch.bfloat16
model._move_auxiliary_models = lambda device: None
model.to("cpu")
assert transformer.to_kwargs == {
"device": torch.device("cpu"),
"dtype": torch.bfloat16,
}
def test_decode_rejects_condition_length_that_cannot_tile():
model = LDFVFIModel.__new__(LDFVFIModel)
model.vae = _RecordingConditionalVAE()