Spaces:
Running on Zero
Running on Zero
Download h3_split_blocks.py from dima0987654321/2NET-MotionEnhancerLoRA: direct link, hf CLI and curl.
- Browser
- Download file 3.12 kB
-
https://huggingface.co/spaces/dima0987654321/2NET-MotionEnhancerLoRA/resolve/main/h3_split_blocks.py
- Command line
-
hf download hf://spaces/dima0987654321/2NET-MotionEnhancerLoRA/h3_split_blocks.py
-
curl -L -o h3_split_blocks.py https://huggingface.co/spaces/dima0987654321/2NET-MotionEnhancerLoRA/resolve/main/h3_split_blocks.py
3.12 kB
| """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"] | |
| 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"] | |
| 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." | |
| ) | |
| def outputs(self): | |
| return _generation_outputs() | |
| class MiniMaxH3Ref2VAConditionerBlocks(SequentialPipelineBlocks): | |
| model_name = "minimax-h3" | |
| block_classes = [MiniMaxH3Ref2VASetupStep, MiniMaxH3Ref2VATextEncoderStep] | |
| block_names = ["setup", "text_encoder"] | |
| 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"] | |
| def outputs(self): | |
| return _generation_outputs() | |