Skip to content
Open
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
12 changes: 9 additions & 3 deletions src/diffusers/modular_pipelines/minimax_h3/before_denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from ...schedulers import MiniMaxH3Scheduler
from ...utils import logging
from ...utils.torch_utils import randn_tensor
from ...utils.torch_utils import maybe_adjust_dtype_for_device, randn_tensor
from ..modular_pipeline import ModularPipelineBlocks, PipelineState
from ..modular_pipeline_utils import ComponentSpec, ConfigSpec, InputParam, OutputParam
from .modular_pipeline import (
Expand Down Expand Up @@ -441,7 +441,10 @@ def __call__(self, components: MiniMaxH3ModularPipeline, state: PipelineState) -
components.video_tag,
block_state.keyframe_anchors,
)
block_state.position_ids = position_ids.to(device)
# The grid is built in fp64 to reproduce the released coordinates exactly, but MPS, NPU and Neuron have no
# fp64; the transformer's rope casts to fp32 anyway, so downcasting here is all the transfer needs.
position_ids_dtype = maybe_adjust_dtype_for_device(position_ids.dtype, device)
block_state.position_ids = position_ids.to(device, position_ids_dtype)
block_state.token_tags = token_tags.to(device)
block_state.video_indices = video_indices.to(device)
block_state.audio_indices = audio_indices.to(device)
Expand Down Expand Up @@ -765,7 +768,10 @@ def __call__(self, components: MiniMaxH3ModularPipeline, state: PipelineState) -
components.audio_tag,
components.video_tag,
)
block_state.position_ids = position_ids.to(device)
# The grid is built in fp64 to reproduce the released coordinates exactly, but MPS, NPU and Neuron have no
# fp64; the transformer's rope casts to fp32 anyway, so downcasting here is all the transfer needs.
position_ids_dtype = maybe_adjust_dtype_for_device(position_ids.dtype, device)
block_state.position_ids = position_ids.to(device, position_ids_dtype)
block_state.token_tags = token_tags.to(device)
block_state.video_indices = video_indices.to(device)
block_state.audio_indices = audio_indices.to(device)
Expand Down
Loading