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.

chore: format vendored H3 modules with CI's pinned ruff 0.11.2

Lincoln Stein63a9dca8c8f5
diff --git a/invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py b/invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py
index 8e0ea9a370..48ca8cff1b 100644
--- a/invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py
+++ b/invokeai/backend/minimax_h3/autoencoder_kl_minimax_h3_audio.py
@@ -410,10 +410,7 @@ class MiniMaxH3AudioAMPBlock(nn.Module):
[_wn_conv1d(channels, channels, kernel_size, dilation=1, padding=(kernel_size - 1) // 2) for _ in dilation]
)
self.activations = nn.ModuleList(
- [
- MiniMaxH3AudioActivation1d(activation=MiniMaxH3AudioSnakeBeta(channels))
- for _ in range(2 * len(dilation))
- ]
+ [MiniMaxH3AudioActivation1d(activation=MiniMaxH3AudioSnakeBeta(channels)) for _ in range(2 * len(dilation))]
)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
diff --git a/invokeai/backend/minimax_h3/packing.py b/invokeai/backend/minimax_h3/packing.py
index e34de27e74..8b7eb6597e 100644
--- a/invokeai/backend/minimax_h3/packing.py
+++ b/invokeai/backend/minimax_h3/packing.py
@@ -193,9 +193,7 @@ def video_latent_num_frames(num_frames: int) -> int:
"""
if num_frames % MINIMAX_H3_FRAMES_PER_CHUNK != MINIMAX_H3_LATENTS_PER_CHUNK:
raise ValueError(f"`num_frames` must be of the form 17 * n + 5, got {num_frames}.")
- return (
- num_frames - MINIMAX_H3_LATENTS_PER_CHUNK
- ) // MINIMAX_H3_FRAMES_PER_CHUNK * MINIMAX_H3_LATENTS_PER_CHUNK + 2
+ return (num_frames - MINIMAX_H3_LATENTS_PER_CHUNK) // MINIMAX_H3_FRAMES_PER_CHUNK * MINIMAX_H3_LATENTS_PER_CHUNK + 2
def audio_latent_num_frames(num_frames: int) -> int:
diff --git a/invokeai/backend/minimax_h3/transformer_minimax_h3.py b/invokeai/backend/minimax_h3/transformer_minimax_h3.py
index 2181533a33..666d52d778 100644
--- a/invokeai/backend/minimax_h3/transformer_minimax_h3.py
+++ b/invokeai/backend/minimax_h3/transformer_minimax_h3.py
@@ -147,9 +147,7 @@ class MiniMaxH3AdaLayerNormOut(nn.Module):
shift, scale = self.linear(nn.functional.silu(temb).to(self.linear.weight.dtype)).chunk(2, dim=-1)
# The modulation itself stays at the block stack's precision; `forward` casts to the output heads' dtype.
hidden_states = self.norm(hidden_states)
- return hidden_states * (1.0 + scale.index_select(0, timestep_indices)) + shift.index_select(
- 0, timestep_indices
- )
+ return hidden_states * (1.0 + scale.index_select(0, timestep_indices)) + shift.index_select(0, timestep_indices)
class MiniMaxH3AttnProcessor: