Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mochi video-to-video #10000

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions docs/source/en/api/pipelines/mochi.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers.m
- all
- __call__

## MochiVideoToVideoPiepeline

[[autodoc]] MochiVideoToVideoPiepeline
- all
- __call__

## MochiPipelineOutput

[[autodoc]] pipelines.mochi.pipeline_output.MochiPipelineOutput
2 changes: 2 additions & 0 deletions src/diffusers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
"MarigoldDepthPipeline",
"MarigoldNormalsPipeline",
"MochiPipeline",
"MochiVideoToVideoPipeline",
"MusicLDMPipeline",
"PaintByExamplePipeline",
"PIAPipeline",
Expand Down Expand Up @@ -789,6 +790,7 @@
MarigoldDepthPipeline,
MarigoldNormalsPipeline,
MochiPipeline,
MochiVideoToVideoPipeline,
MusicLDMPipeline,
PaintByExamplePipeline,
PIAPipeline,
Expand Down
2 changes: 2 additions & 0 deletions src/diffusers/models/transformers/transformer_mochi.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ def __init__(
time_embed_dim: int = 256,
activation_fn: str = "swiglu",
max_sequence_length: int = 256,
sample_height: int = 60,
sample_width: int = 106,
) -> None:
super().__init__()

Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
"MarigoldNormalsPipeline",
]
)
_import_structure["mochi"] = ["MochiPipeline"]
_import_structure["mochi"] = ["MochiPipeline", "MochiVideoToVideoPipeline"]
_import_structure["musicldm"] = ["MusicLDMPipeline"]
_import_structure["paint_by_example"] = ["PaintByExamplePipeline"]
_import_structure["pia"] = ["PIAPipeline"]
Expand Down Expand Up @@ -582,7 +582,7 @@
MarigoldDepthPipeline,
MarigoldNormalsPipeline,
)
from .mochi import MochiPipeline
from .mochi import MochiPipeline, MochiVideoToVideoPipeline
from .musicldm import MusicLDMPipeline
from .pag import (
AnimateDiffPAGPipeline,
Expand Down
2 changes: 2 additions & 0 deletions src/diffusers/pipelines/mochi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
_dummy_objects.update(get_objects_from_module(dummy_torch_and_transformers_objects))
else:
_import_structure["pipeline_mochi"] = ["MochiPipeline"]
_import_structure["pipeline_mochi_video2video"] = ["MochiVideoToVideoPipeline"]

if TYPE_CHECKING or DIFFUSERS_SLOW_IMPORT:
try:
Expand All @@ -33,6 +34,7 @@
from ...utils.dummy_torch_and_transformers_objects import *
else:
from .pipeline_mochi import MochiPipeline
from .pipeline_mochi_video2video import MochiVideoToVideoPipeline

else:
import sys
Expand Down
6 changes: 2 additions & 4 deletions src/diffusers/pipelines/mochi/pipeline_mochi.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ def __init__(
self.tokenizer_max_length = (
self.tokenizer.model_max_length if hasattr(self, "tokenizer") and self.tokenizer is not None else 77
)
self.default_height = 480
self.default_width = 848

# Adapted from diffusers.pipelines.cogvideo.pipeline_cogvideox.CogVideoXPipeline._get_t5_prompt_embeds
def _get_t5_prompt_embeds(
Expand Down Expand Up @@ -577,8 +575,8 @@ def __call__(
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs

height = height or self.default_height
width = width or self.default_width
height = height or self.transformer.config.sample_height * self.vae_spatial_scale_factor
width = width or self.transformer.config.sample_width * self.vae_spatial_scale_factor

# 1. Check inputs. Raise error if not correct
self.check_inputs(
Expand Down
Loading
Loading