[Feature] Add official LTX multimodal guidance and precision guard (#5148)
Signed-off-by: mglyn <1203789601@qq.com>
This commit is contained in:
1 parent
66a9b0c84f
commit
12d75cf63a
51 files changed
+4547
-3062
No files matched your search
@@ -14,7 +14,7 @@ pytestmark = [pytest.mark.core_model, pytest.mark.cpu]
|
||||
class TestLTXOutputRank:
|
||||
@pytest.mark.parametrize(
|
||||
("distributed_vae_state", "expected_decode_calls"),
|
||||
[(False, 0), (True, 1), (RuntimeError("unavailable"), 0)],
|
||||
[(False, 0), (True, 1), (RuntimeError("unavailable"), None)],
|
||||
)
|
||||
def test_non_output_rank_only_enters_collective_vae_decode(
|
||||
self,
|
||||
@@ -22,7 +22,8 @@ class TestLTXOutputRank:
|
||||
distributed_vae_state,
|
||||
expected_decode_calls,
|
||||
):
|
||||
import vllm_omni.diffusion.models.ltx2.pipeline_ltx2 as ltx
|
||||
import vllm_omni.diffusion.models.ltx2.ltx2_runtime as ltx_runtime
|
||||
from vllm_omni.diffusion.models.ltx2.pipeline_ltx2 import LTX2Pipeline
|
||||
|
||||
class FakeVae:
|
||||
dtype = torch.float32
|
||||
@@ -40,23 +41,30 @@ class TestLTXOutputRank:
|
||||
self.decode_calls += 1
|
||||
return (torch.ones(1, 1),)
|
||||
|
||||
monkeypatch.setattr(ltx.torch.distributed, "is_initialized", lambda: True)
|
||||
monkeypatch.setattr(ltx.torch.distributed, "get_rank", lambda: 1)
|
||||
pipe = object.__new__(ltx.LTX2Pipeline)
|
||||
monkeypatch.setattr(ltx_runtime.torch.distributed, "is_initialized", lambda: True)
|
||||
monkeypatch.setattr(ltx_runtime.torch.distributed, "get_rank", lambda: 1)
|
||||
pipe = object.__new__(LTX2Pipeline)
|
||||
torch.nn.Module.__init__(pipe)
|
||||
pipe.vae = FakeVae()
|
||||
|
||||
output = pipe._decode_output(
|
||||
latents=torch.ones(1, 1),
|
||||
audio_latents=torch.ones(1, 1),
|
||||
output_type="np",
|
||||
connector_prompt_embeds=torch.ones(1, 1),
|
||||
generator=None,
|
||||
device=torch.device("cpu"),
|
||||
decode_timestep=0.0,
|
||||
decode_noise_scale=None,
|
||||
prompt_batch_size=1,
|
||||
)
|
||||
decode_kwargs = {
|
||||
"latents": torch.ones(1, 1),
|
||||
"audio_latents": torch.ones(1, 1),
|
||||
"output_type": "np",
|
||||
"connector_prompt_embeds": torch.ones(1, 1),
|
||||
"generator": None,
|
||||
"device": torch.device("cpu"),
|
||||
"decode_timestep": 0.0,
|
||||
"decode_noise_scale": None,
|
||||
"prompt_batch_size": 1,
|
||||
}
|
||||
if isinstance(distributed_vae_state, Exception):
|
||||
with pytest.raises(RuntimeError, match="unavailable"):
|
||||
pipe._decode_output(**decode_kwargs)
|
||||
assert pipe.vae.decode_calls == 0
|
||||
return
|
||||
|
||||
output = pipe._decode_output(**decode_kwargs)
|
||||
|
||||
assert pipe.vae.decode_calls == expected_decode_calls
|
||||
assert output.output[0].numel() == 0
|
||||
|
||||
Reference in new issue
Block a user