Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

Merge branch 'main' into minimax-h3/13-dimension-presets

Lincoln Stein601894461e5f
diff --cc invokeai/app/invocations/minimax_h3_denoise.py
index e4bf3cbaee,d7bac2635f..1f75bd6f64
--- a/invokeai/app/invocations/minimax_h3_denoise.py
+++ b/invokeai/app/invocations/minimax_h3_denoise.py
@@@ -52,9 -49,9 +52,10 @@@ from invokeai.backend.minimax_h3.pruned
from invokeai.backend.minimax_h3.sampling import (
MINIMAX_H3_PATCH_SIZE,
MINIMAX_H3_SPATIAL_COMPRESSION,
+ MINIMAX_H3_STILL_NUM_FRAMES,
MINIMAX_H3_VAE_LATENT_CHANNELS,
build_denoise_state,
+ validate_canvas,
validate_num_frames,
)
from invokeai.backend.minimax_h3.taehv_decoder import TAEH3_PREVIEW_MODEL_URL, TAEH3Decoder
@@@ -224,10 -186,8 +225,11 @@@ class MiniMaxH3DenoiseInvocation(BaseIn
@torch.no_grad()
def invoke(self, context: InvocationContext) -> MiniMaxH3DenoiseOutput:
- validate_num_frames(self.num_frames)
+ # The field is a choice list of grid-aligned strings; validate anyway so a hand-authored graph that
+ # bypasses the dropdown still fails here rather than deep in the VAE.
+ num_frames = int(self.num_frames)
+ validate_num_frames(num_frames)
+ validate_canvas(self.height, self.width)
device = TorchDevice.choose_torch_device()
diff --cc invokeai/backend/minimax_h3/sampling.py
index 4f12408caa,3f2d7235ac..a1bd92b0c5
--- a/invokeai/backend/minimax_h3/sampling.py
+++ b/invokeai/backend/minimax_h3/sampling.py
@@@ -23,7 -24,12 +24,11 @@@ from invokeai.backend.minimax_h3.packin
MINIMAX_H3_FRAMES_PER_CHUNK,
MINIMAX_H3_KEYFRAME_NOISE_AUG,
MINIMAX_H3_LATENTS_PER_CHUNK,
+ MINIMAX_H3_MAX_ASPECT_RATIO,
MINIMAX_H3_MAX_DURATION,
+ MINIMAX_H3_MAX_PIXELS,
+ MINIMAX_H3_MIN_ASPECT_RATIO,
- MINIMAX_H3_MIN_DURATION,
+ MINIMAX_H3_SHORT_EDGE,
MiniMaxH3PackedSequence,
build_packed_sequence,
build_row_timesteps,
diff --cc tests/backend/minimax_h3/test_sampling.py
index 714522a68b,94387243b0..84da07bf38
--- a/tests/backend/minimax_h3/test_sampling.py
+++ b/tests/backend/minimax_h3/test_sampling.py
@@@ -9,8 -9,43 +9,44 @@@ from invokeai.backend.minimax_h3.packin
resolve_canvas_size,
video_latent_num_frames,
)
+from invokeai.backend.minimax_h3.presets import MINIMAX_H3_VIDEO_FRAME_CHOICES, resolve_lowres_canvas_size
- from invokeai.backend.minimax_h3.sampling import build_denoise_state, validate_num_frames
+ from invokeai.backend.minimax_h3.sampling import build_denoise_state, validate_canvas, validate_num_frames
+
+
+ class TestCanvas:
+ def test_every_resolvable_canvas_is_accepted(self):
+ # The guard must never reject a canvas resolve_canvas_size can emit. Rounding both axes to
+ # the 32 grid happens *after* the area cap, so its own outputs reach ~1.04x the cap.
+ canvases = set()
+ for index in range(1501):
+ ratio = min(0.25 + index * (3.75 / 1500), 4.0)
+ canvases.add(resolve_canvas_size(ratio, 1.0))
+ assert len(canvases) > 50
+ for height, width in canvases:
+ validate_canvas(height, width)
+
+ def test_native_canvas_accepted(self):
+ validate_canvas(768, 1344)
+ validate_canvas(1344, 768)
+
+ def test_oversized_canvas_rejected(self):
+ # 4096x4096 builds a ~607k-row packed sequence against the native canvas's ~38k.
+ with pytest.raises(ValueError, match="soft area cap"):
+ validate_canvas(4096, 4096)
+ with pytest.raises(ValueError, match="soft area cap"):
+ validate_canvas(2048, 2048)
+
+ def test_off_grid_canvas_rejected(self):
+ with pytest.raises(ValueError, match="multiples of 32"):
+ validate_canvas(768, 1000)
+
+ def test_extreme_aspect_ratio_rejected(self):
+ with pytest.raises(ValueError, match="aspect ratios"):
+ validate_canvas(128, 1344)
+
+ def test_nonpositive_rejected(self):
+ with pytest.raises(ValueError, match="must be positive"):
+ validate_canvas(0, 1344)
class TestFrameGrid: