Skip to content

integrate MOVA model with LightX2V (pre-alpha, requires manual path adjustment)#898

Open
zaochen123 wants to merge 1 commit intoModelTC:mainfrom
zaochen123:feat/mova-integration
Open

integrate MOVA model with LightX2V (pre-alpha, requires manual path adjustment)#898
zaochen123 wants to merge 1 commit intoModelTC:mainfrom
zaochen123:feat/mova-integration

Conversation

@zaochen123
Copy link

This PR adds initial support for the MOVA model (OpenMOSS/MOVA) to LightX2V. The integration directly calls the official MOVA pipeline, ensuring correctness while enabling LightX2V’s base optimizations (FlashAttention, etc.).

⚠️ Important Note on Paths

The code currently contains hard‑coded absolute paths pointing to the developer’s AFS environment (/devsft_AFS/). Before running, you must replace these with your own paths. The following files need adjustment:

  1. configs/mova/mova_t2v.json

    • "model_path": change to your local MOVA weights directory.
  2. examples/mova/mova_t2v.py

    • config_path: update to the correct location of the config file.
    • image_path: set to your input image.
    • save_result_path: set to your desired output location.

Example of required changes (search for /devsft_AFS in the files).

What’s included

  • MOVA runner: lightx2v/models/runners/mova/mova_runner.py
  • Example script: examples/mova/mova_t2v.py
  • Configuration: configs/mova/mova_t2v.json
  • Verified with MOVA-720p weights – generates a cat‑boxing video identical to the official result.

How to test after fixing paths

  1. Install the MOVA official package:
    pip install -e /path/to/mova_official
  2. Download MOVA-720p weights from Hugging Face.
  3. Adjust the paths as described above.
  4. Run:
    cd examples/mova
    python mova_t2v.py

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @zaochen123, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces preliminary support for the MOVA model within the LightX2V framework. The integration focuses on enabling image-to-audio-video generation by wrapping the official MOVA pipeline, allowing it to benefit from LightX2V's performance enhancements. This provides users with the capability to generate high-quality videos using the MOVA model, albeit with an initial manual path configuration step.

Highlights

  • MOVA Model Integration: Initial support for the MOVA model (OpenMOSS/MOVA) has been added, enabling image-to-audio-video (i2av) generation within LightX2V.
  • Official Pipeline Utilization: The integration directly calls the official MOVA pipeline, ensuring correctness while leveraging LightX2V's base optimizations like FlashAttention.
  • Configuration and Example: A new configuration file (configs/mova/mova_t2v.json) and an example script (examples/mova/mova_t2v.py) are included to facilitate MOVA model usage.
  • Path Adjustment Required: The current implementation contains hard-coded absolute paths that must be manually adjusted by the user before running the model.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • configs/mova/mova_t2v.json
    • Added initial configuration for the MOVA model, including model path, dimensions, and inference parameters.
  • examples/mova/mova_t2v.py
    • Introduced an example script to showcase MOVA model usage within LightX2V, including pipeline setup, configuration loading, and video generation.
  • lightx2v/models/runners/mova/mova_runner.py
    • Created a dedicated MOVARunner to encapsulate the MOVA model's official inference pipeline, managing distributed training setup and video output.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces initial support for the MOVA model. While this is a valuable addition, the current implementation has several critical issues that should be addressed before merging, even for a pre-alpha version. The code contains numerous hard-coded absolute paths, making it non-portable. The example script is not runnable without significant manual changes. The MOVARunner integration with the existing framework is not clean, bypassing the intended abstractions and making it difficult to maintain. There are also potential resource leaks and robustness issues, such as an un-deleted temporary file and a hard-coded network port. My review provides specific suggestions to resolve these problems.

{
"model_cls": "mova",
"task": "i2av",
"model_path": "/devsft_AFS/mova_weights",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Hard-coded absolute paths should be avoided as they make the configuration not portable. Please use a placeholder value like <PATH_TO_YOUR_MOVA_WEIGHTS> and add a note in the documentation for users to replace it. This makes it explicit that a user action is required.

Suggested change
"model_path": "/devsft_AFS/mova_weights",
"model_path": "<PATH_TO_YOUR_MOVA_WEIGHTS>",

@@ -0,0 +1,36 @@
import os
import sys
sys.path.append('/devsft_AFS/mova_code/LightX2V')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Modifying sys.path with a hard-coded absolute path is a critical anti-pattern. It makes the script entirely non-portable and dependent on a specific developer's environment. This should be removed. The project should be set up to be runnable without such hacks, for example by installing it in editable mode (pip install -e .) and running examples from the project root.

Comment on lines +7 to +11
pipe = LightX2VPipeline(
model_path="/devsft_AFS/mova_weights", # 权重路径
model_cls="mova",
task="i2av",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This script contains multiple hard-coded absolute paths for model, config (lines 8, 13), and output files (lines 27, 28). This makes the example impossible to run for other users without manually editing the source code. These paths should be parameterized using command-line arguments (e.g., with argparse). Default values can be relative paths to make the example easier to run out-of-the-box.



@RUNNER_REGISTER("mova")
class MOVARunner(DefaultRunner):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The MOVARunner inherits from DefaultRunner but doesn't adhere to its contract. It overrides run_pipeline with a completely custom implementation and leaves other essential methods like run_text_encoder and run_vae_encoder as empty placeholders. This breaks the abstraction and makes the code harder to maintain and reason about. Consider refactoring this to either properly implement the DefaultRunner interface or inherit from BaseRunner if the execution model is fundamentally different.

Comment on lines +59 to +70
temp_file = tempfile.NamedTemporaryFile(delete=False)
init_method = f"file://{temp_file.name}"
temp_file.close()
dist.init_process_group(
backend="nccl",
init_method=init_method,
rank=0,
world_size=1
)
print("Initialized single-process distributed group with file init_method.")
self._dist_initialized = True
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The temporary file created for the file-system-based process group initialization is not being deleted, which will lead to a resource leak, leaving temporary files on the system. You should wrap the initialization logic in a try...finally block to ensure the file is removed after it's no longer needed.

Suggested change
temp_file = tempfile.NamedTemporaryFile(delete=False)
init_method = f"file://{temp_file.name}"
temp_file.close()
dist.init_process_group(
backend="nccl",
init_method=init_method,
rank=0,
world_size=1
)
print("Initialized single-process distributed group with file init_method.")
self._dist_initialized = True
return True
temp_file = tempfile.NamedTemporaryFile(delete=False)
try:
init_method = f"file://{temp_file.name}"
temp_file.close()
dist.init_process_group(
backend="nccl",
init_method=init_method,
rank=0,
world_size=1
)
print("Initialized single-process distributed group with file init_method.")
self._dist_initialized = True
return True
finally:
if os.path.exists(temp_file.name):
os.unlink(temp_file.name)

if not self._dist_initialized:
if not self._init_distributed():
os.environ.setdefault("MASTER_ADDR", "localhost")
os.environ.setdefault("MASTER_PORT", "29500")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hard-coding the MASTER_PORT to 29500 can lead to port conflicts if multiple processes are run on the same machine. It's more robust to find a free port dynamically at runtime, for example by using the socket module to bind to port 0 and get the assigned port.

@zaochen123 zaochen123 force-pushed the feat/mova-integration branch from b3135fd to 65e6e22 Compare February 26, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants