Skip to content

Commit fa9ff03

Browse files
authored
Fix Text2VideoPipeline crash with guidance_scale=1 when using default constructor (openvinotoolkit#3316)
Fixed regression where Text2VideoPipeline(model_dir, device) followed by generate(guidance_scale=1.0) crashes with an assertion error. The direct-compile constructor incorrectly assumed the model was compiled for CFG based on the default config's guidance_scale, even though no reshape() was called and the model has dynamic shapes. Also added a regression test for this scenario.
1 parent d8d6477 commit fa9ff03

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/cpp/src/video_generation/ltx_pipeline.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,6 @@ class Text2VideoPipeline::LTXPipeline {
410410
m_vae_device = device;
411411
m_compile_properties = properties;
412412
m_is_compiled = true;
413-
m_reshape_batch_size_multiplier = do_classifier_free_guidance(m_generation_config.guidance_scale) ? 2 : 1;
414-
m_compiled_batch_size_multiplier = m_reshape_batch_size_multiplier;
415413
const std::filesystem::path model_index_path = models_dir / "model_index.json";
416414
std::ifstream file(model_index_path);
417415
OPENVINO_ASSERT(file.is_open(), "Failed to open ", model_index_path);

tests/python_tests/test_video_generation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,19 @@ def test_reshape(self, video_generation_model):
232232
result = pipe.generate("test prompt", num_inference_steps=2)
233233
assert result.video is not None
234234

235+
def test_generate_without_cfg_default_compile(self, video_generation_model):
236+
"""Regression test: direct-compile constructor should work with guidance_scale <= 1."""
237+
pipe = ov_genai.Text2VideoPipeline(video_generation_model, "CPU")
238+
result = pipe.generate(
239+
"test prompt",
240+
guidance_scale=1.0,
241+
height=32,
242+
width=32,
243+
num_frames=9,
244+
num_inference_steps=2,
245+
)
246+
assert result.video is not None
247+
235248
def test_generate_without_cfg_after_reshape_with_cfg(self, video_generation_model):
236249
"""Test: reshape with CFG then generate without CFG should raise error."""
237250
pipe = ov_genai.Text2VideoPipeline(video_generation_model)

0 commit comments

Comments
 (0)