Spaces:
Running on Zero
Running on Zero
File size: 3,115 Bytes
8b21446 1c9dd72 8b21446 1c9dd72 8b21446 1c9dd72 8b21446 1c9dd72 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | """The denoising half of MiniMax-H3 used by this Space.
The Qwen3-VL conditioner is served by the public
multimodalart/qwen3vl-conditioner Space so the generator can fit on ZeroGPU.
"""
from diffusers.modular_pipelines.minimax_h3.before_encoder import MiniMaxH3Ref2VASetupStep
from diffusers.modular_pipelines.minimax_h3.decoders import MiniMaxH3AfterDenoiseStep
from diffusers.modular_pipelines.minimax_h3.encoders import (
MiniMaxH3Ref2VAReferenceEncoderStep,
MiniMaxH3Ref2VATextEncoderStep,
MiniMaxH3TextEncoderStep,
)
from diffusers.modular_pipelines.minimax_h3.modular_blocks_minimax_h3 import (
MiniMaxH3AutoKeyframeVaeEncoderStep,
MiniMaxH3AutoResizeStep,
MiniMaxH3CoreDenoiseStep,
MiniMaxH3DecodeStep,
MiniMaxH3Ref2VACoreDenoiseStep,
_generation_outputs,
)
from diffusers.modular_pipelines.modular_pipeline import SequentialPipelineBlocks
from diffusers.modular_pipelines.modular_pipeline_utils import OutputParam
def _wire_outputs(num_frames: bool = True) -> list[OutputParam]:
return [
OutputParam.template("prompt_embeds"),
OutputParam("text_token_tags", description="The per-row modality tag of every row of prompt_embeds."),
OutputParam("height", type_hint=int),
OutputParam("width", type_hint=int),
*([OutputParam("num_frames", type_hint=int)] if num_frames else []),
]
class MiniMaxH3ConditionerBlocks(SequentialPipelineBlocks):
model_name = "minimax-h3"
block_classes = [MiniMaxH3AutoResizeStep, MiniMaxH3TextEncoderStep]
block_names = ["resize", "text_encoder"]
@property
def outputs(self):
return _wire_outputs(num_frames=False)
class MiniMaxH3GeneratorBlocks(SequentialPipelineBlocks):
model_name = "minimax-h3"
block_classes = [
MiniMaxH3AutoResizeStep,
MiniMaxH3AutoKeyframeVaeEncoderStep,
MiniMaxH3CoreDenoiseStep,
MiniMaxH3AfterDenoiseStep,
MiniMaxH3DecodeStep,
]
block_names = ["resize", "vae_encoder", "denoise", "after_denoise", "decode"]
@property
def description(self):
return (
"The denoising half of MiniMax-H3 with the text encoder removed. "
"Prompt embeddings and token tags arrive from the external conditioner Space."
)
@property
def outputs(self):
return _generation_outputs()
class MiniMaxH3Ref2VAConditionerBlocks(SequentialPipelineBlocks):
model_name = "minimax-h3"
block_classes = [MiniMaxH3Ref2VASetupStep, MiniMaxH3Ref2VATextEncoderStep]
block_names = ["setup", "text_encoder"]
@property
def outputs(self):
return _wire_outputs()
class MiniMaxH3Ref2VAGeneratorBlocks(SequentialPipelineBlocks):
model_name = "minimax-h3"
block_classes = [
MiniMaxH3Ref2VASetupStep,
MiniMaxH3Ref2VAReferenceEncoderStep,
MiniMaxH3Ref2VACoreDenoiseStep,
MiniMaxH3AfterDenoiseStep,
MiniMaxH3DecodeStep,
]
block_names = ["setup", "reference_encoder", "denoise", "after_denoise", "decode"]
@property
def outputs(self):
return _generation_outputs()
|