[Bugfix][MiniMax-H3] Use Hopper-safe modulation precision

Signed-off-by: david6666666 <530634352@qq.com>
This commit is contained in:
david6666666 committed 2026-09-18 02:08:23 +00:00
1 parent 3b84cc4a7f
commit 49fa488951
6 files changed
+101 -57

No files matched your search

@@ -1953,22 +1953,7 @@ class MiniMaxH3Pipeline(
def _encode_local_media(self, media: MiniMaxH3EncoderMediaInput | None) -> MiniMaxH3EncoderMediaConditioning:
group, rank, world_size = _dit_rank_world()
# Keep image/keyframe encoding on the output rank. The legacy
# single-stage path encoded images locally and only used the tiled VAE
# collective for reference videos. Treating every visual input as a
# distributed video after the unified encoder path was introduced
# changes the H100 keyframe latent and therefore the I2VA trajectory.
distributed_vae = self.video_vae.is_distributed_enabled()
distributed_video = False
if distributed_vae:
has_video = torch.tensor(
[int(media is not None and bool(media.videos))],
dtype=torch.long,
device=self.device,
)
if world_size > 1:
dist.broadcast(has_video, src=0, group=group)
distributed_video = bool(has_video.item())
distributed_video = self.video_vae.is_distributed_enabled()
if distributed_video:
media = self._distribute_media_inputs(media)
conditioning = None
@@ -1981,7 +1966,6 @@ class MiniMaxH3Pipeline(
video_vae=self.video_vae,
audio_vae=self.audio_vae,
emit_conditioning=rank == 0,
encode_images=rank == 0,
component_scope=self._component_on_device,
)
except ValueError as exc:
+2 -7
View File
@@ -602,13 +602,8 @@ class MiniMaxH3VideoVAE(nn.Module, DistributedVaeMixin):
if getattr(self, "decode_only", False):
raise RuntimeError("MiniMax H3 decode-only video VAE cannot encode images")
previous_parallel = self.model.parallel_tiling
parallel_size = int(getattr(self, "parallel_size", 1))
if parallel_size <= 1:
if int(getattr(self, "parallel_size", 1)) <= 1:
self.model.parallel_tiling = False
# Keyframe conditioning follows the official single-image contract.
# Do not let it enter the tiled VAE collective even when reference
# videos use the same VAE instance with patch parallelism enabled.
tiling_context = self._rank_local_tiling() if parallel_size > 1 else nullcontext()
parameter = next(self.parameters())
previous_dtype = parameter.dtype
if previous_dtype != torch.float32:
@@ -616,7 +611,7 @@ class MiniMaxH3VideoVAE(nn.Module, DistributedVaeMixin):
devices = [parameter.device] if parameter.device.type != "cpu" else []
try:
with (
tiling_context,
self._encoder_tiling_context(image.height, image.width),
torch.random.fork_rng(
devices=devices,
device_type=parameter.device.type,