Skip to content
Open
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
ca46149
Add text2video
Wovchena Jul 11, 2025
bd2147c
fix compilation
Wovchena Jul 21, 2025
4cac671
Add configs
Wovchena Jul 21, 2025
03a3214
Infer text encoder
Wovchena Jul 21, 2025
523e1b7
timesteps
Wovchena Jul 25, 2025
507243a
style
Wovchena Jul 25, 2025
ce2fc1a
floats
Wovchena Jul 25, 2025
01860a9
floats
Wovchena Jul 25, 2025
382c95a
OPENVINO_SUPPRESS_DEPRECATED_START
Wovchena Jul 25, 2025
c3f0f23
brackets
Wovchena Jul 25, 2025
bfe8b75
print
Wovchena Jul 28, 2025
5e45023
transformer info
Wovchena Jul 28, 2025
9333f2c
add header
Wovchena Sep 12, 2025
5bc47e2
VideoGenerationConfig
Wovchena Sep 12, 2025
c0955de
rm namepsace
Wovchena Sep 12, 2025
9877050
video
Wovchena Sep 12, 2025
fb7779c
notes
Wovchena Sep 12, 2025
7979274
update todos
Wovchena Sep 25, 2025
ff5142d
add ltx-video.py
Wovchena Sep 25, 2025
4bfcb56
Add LTXPipeline sample
Wovchena Sep 25, 2025
9210546
print
Wovchena Sep 25, 2025
760fb1a
fix compilation
Wovchena Sep 25, 2025
ebc2af7
comma
Wovchena Sep 25, 2025
ee5024d
ltx_pipeline_output
Wovchena Sep 25, 2025
39dc772
namepsace
Wovchena Sep 25, 2025
1734154
ms
Wovchena Sep 25, 2025
72c218e
apply todo
Wovchena Sep 25, 2025
3641733
fix
likholat Sep 29, 2025
167a115
promp attention mask supported
likholat Oct 6, 2025
94a5025
bad transformer output
likholat Oct 10, 2025
f5340b5
bad transformer output
likholat Oct 17, 2025
159a35a
rm commented code
likholat Oct 17, 2025
58bc4e2
postprocessing and imwrite video
likholat Oct 24, 2025
3c8d28b
Download stb_image_write.h
Wovchena Oct 27, 2025
aeaac74
have to be divisible by 32
Wovchena Oct 27, 2025
2651dea
Remove implemented todo
Wovchena Oct 27, 2025
a8b0faa
reorder
Wovchena Oct 27, 2025
9ae7f7e
grammar
Wovchena Oct 27, 2025
cf7d1af
Add video_similarity.py
Wovchena Oct 28, 2025
8234332
Add video_similarity.py
Wovchena Oct 28, 2025
fdb40fe
fix similarity for identical
Wovchena Oct 28, 2025
dd8db2c
remove sample_video
Wovchena Oct 30, 2025
c377b2f
timesteps
Wovchena Jul 25, 2025
a5af67c
style
Wovchena Jul 25, 2025
fb92959
floats
Wovchena Jul 25, 2025
97bbef1
print
Wovchena Jul 28, 2025
e34ebbb
VideoGenerationConfig
Wovchena Sep 12, 2025
ef19c8d
rm namepsace
Wovchena Sep 12, 2025
46c3e6e
namepsace
Wovchena Sep 25, 2025
3e5d350
ms
Wovchena Sep 25, 2025
42af2e8
apply todo
Wovchena Sep 25, 2025
b29ac60
fix
likholat Sep 29, 2025
08e5a28
promp attention mask supported
likholat Oct 6, 2025
1dc5e55
bad transformer output
likholat Oct 10, 2025
5dfa51d
bad transformer output
likholat Oct 17, 2025
5032b10
rm commented code
likholat Oct 17, 2025
8248903
postprocessing and imwrite video
likholat Oct 24, 2025
92058e7
Download stb_image_write.h
Wovchena Oct 27, 2025
0a5f271
Add validate() and update_generation_config() for VideoGenerationConfig
Wovchena Oct 30, 2025
d19c82e
Align defaults
Wovchena Oct 31, 2025
cf25a38
Relax validate
Wovchena Oct 31, 2025
ccdda50
split line
Wovchena Oct 31, 2025
7659708
perfomance stat
likholat Oct 31, 2025
e5ac519
sample output update
likholat Oct 31, 2025
2db1845
Move VideoGenerationConfig to a separate file
Wovchena Nov 1, 2025
b07dd6b
Remove negative_prompt from signature
Wovchena Nov 3, 2025
9ab73e9
imwrite_video fps
likholat Nov 3, 2025
f508230
Fix Windows compilation
Wovchena Nov 5, 2025
7e10c99
text2video header update
likholat Nov 6, 2025
fe96548
align optimum and genai outputs
likholat Nov 6, 2025
e9a9525
fixes after rebase
likholat Nov 10, 2025
72e2955
decode method
likholat Nov 18, 2025
5d8b19f
Merge remote-tracking branch 'origin/master' into new_ltx_text2video
likholat Nov 18, 2025
fc19f79
codestyle fixes
likholat Nov 18, 2025
0914ece
rm debug methods
likholat Nov 21, 2025
23d5c36
codestyle fixes
likholat Nov 24, 2025
c04ee06
codestyle fixes
likholat Nov 24, 2025
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
56 changes: 56 additions & 0 deletions ltx-video.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import argparse
import torch
import openvino
import numpy as np
from optimum.intel.openvino import OVLTXPipeline # OVDiffusionPipeline
from diffusers import LTXPipeline
from diffusers.utils import export_to_video


def generate(pipeline, frame_rate):
# prompt = "Will Smith eating spaghetti"
prompt = "A woman with long brown hair and light skin smiles at another woman...A woman with long brown hair and light skin smiles at another woman with long blonde hair. The woman with brown hair wears a black jacket and has a small, barely noticeable mole on her right cheek. The camera angle is a close-up, focused on the woman with brown hair's face. The lighting is warm and natural, likely from the setting sun, casting a soft glow on the scene. The scene appears to be real-life footage."
negative_prompt = "worst quality, inconsistent motion, blurry, jittery, distorted"
ltx_pipeline_output = pipeline(
prompt=prompt,
negative_prompt=negative_prompt,
height=128,
width=128,
num_frames=65,
frame_rate=frame_rate,
num_inference_steps=15,
generator=torch.Generator(device="cpu").manual_seed(42),
guidance_scale=3,
)
return ltx_pipeline_output.frames[0]


def main():
parser = argparse.ArgumentParser()
parser.add_argument('model_dir', help='Path to the model directory')
args = parser.parse_args()
frame_rate = 25

ov_pipe = OVLTXPipeline.from_pretrained(
args.model_dir,
device='CPU',
load_in_8bit=False,
ov_config={openvino.properties.hint.inference_precision: openvino.Type.f32},
)
ov_video = generate(ov_pipe, frame_rate)
print(ov_video)
export_to_video(ov_video, "optimum_video.mp4", fps=frame_rate)

# diffusers_pipeline = LTXPipeline.from_pretrained("Lightricks/LTX-Video", torch_dtype=torch.float32)
# diffusers_video = generate(diffusers_pipeline, frame_rate)
# export_to_video(diffusers_video, "diffusers_video.mp4", fps=frame_rate)

# max_diff = np.abs(
# np.stack(ov_video, dtype=np.int16) - np.stack(diffusers_video, dtype=np.int16)
# ).max()
# print(max_diff)
# assert max_diff <= 9


if "__main__" == __name__:
main()
3 changes: 3 additions & 0 deletions samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
if(ENABLE_SAMPLES)
add_subdirectory(cpp/text_generation)
add_subdirectory(cpp/image_generation)
add_subdirectory(cpp/video_generation)
add_subdirectory(cpp/speech_generation)
add_subdirectory(cpp/visual_language_chat)
add_subdirectory(cpp/whisper_speech_recognition)
Expand All @@ -23,6 +24,7 @@ install(FILES
install(DIRECTORY
cpp/text_generation
cpp/image_generation
cpp/video_generation
cpp/speech_generation
cpp/visual_language_chat
cpp/whisper_speech_recognition
Expand All @@ -32,6 +34,7 @@ install(DIRECTORY
install(DIRECTORY
python/text_generation
python/image_generation
python/video_generation
python/speech_generation
python/visual_language_chat
python/whisper_speech_recognition
Expand Down
3 changes: 2 additions & 1 deletion samples/cpp/image_generation/progress_bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <optional>

#include "indicators/progress_bar.hpp"
#include <openvino/runtime/tensor.hpp>

bool progress_bar(size_t step, size_t num_steps, ov::Tensor& /* latent */) {
using namespace indicators;
Expand All @@ -21,7 +22,7 @@ bool progress_bar(size_t step, size_t num_steps, ov::Tensor& /* latent */) {
}

std::stringstream stream;
stream << "Image generation step " << (step + 1) << " / " << num_steps;
stream << "Generation step " << (step + 1) << " / " << num_steps;

bar->set_option(option::PostfixText{stream.str()});
bar->set_progress((100 * (step + 1)) / num_steps);
Expand Down
41 changes: 41 additions & 0 deletions samples/cpp/video_generation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2023-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

find_package(OpenVINOGenAI REQUIRED
PATHS
"${CMAKE_BINARY_DIR}" # Reuse the package from the build.
${OpenVINO_DIR} # GenAI may be installed alogside OpenVINO.
NO_CMAKE_FIND_ROOT_PATH
)

file(DOWNLOAD https://raw.githubusercontent.com/nothings/stb/f75e8d1cad7d90d72ef7a4661f1b994ef78b4e31/stb_image_write.h ${CMAKE_BINARY_DIR}/stb_image_write.h
EXPECTED_HASH MD5=845b8b43d7d941890a57a477455558ad)

include(FetchContent)

if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()

FetchContent_Declare(indicators
URL https://github.com/p-ranav/indicators/archive/refs/tags/v2.3.tar.gz
URL_HASH SHA256=70da7a693ff7a6a283850ab6d62acf628eea17d386488af8918576d0760aef7b)
FetchContent_MakeAvailable(indicators)

# create main sample executable

add_executable(text2video text2video.cpp)

target_include_directories(text2video PRIVATE ${CMAKE_BINARY_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/../image_generation/" "${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cpp/src/")
target_link_libraries(text2video PRIVATE openvino::genai indicators::indicators)

target_sources(text2video PRIVATE imwrite_video.cpp)

set_target_properties(text2video PROPERTIES
# Ensure out of box LC_RPATH on macOS with SIP
INSTALL_RPATH_USE_LINK_PATH ON)

install(TARGETS text2video
RUNTIME DESTINATION samples_bin/
COMPONENT samples_bin
EXCLUDE_FROM_ALL)
Loading
Loading