Spaces:
Sleeping
Sleeping
Upload h3_split_blocks.py with huggingface_hub
Browse files- h3_split_blocks.py +14 -2
h3_split_blocks.py
CHANGED
|
@@ -9,6 +9,8 @@ Same layout as the character-swap H3 Space (`hugging-apps/minimax-h3-character-s
|
|
| 9 |
subclass against the same diffusers classes.
|
| 10 |
"""
|
| 11 |
|
|
|
|
|
|
|
| 12 |
from diffusers.modular_pipelines.minimax_h3.before_encoder import MiniMaxH3Ref2VASetupStep
|
| 13 |
from diffusers.modular_pipelines.minimax_h3.decoders import MiniMaxH3AfterDenoiseStep
|
| 14 |
from diffusers.modular_pipelines.minimax_h3.encoders import MiniMaxH3Ref2VAReferenceEncoderStep
|
|
@@ -16,8 +18,8 @@ from diffusers.modular_pipelines.modular_pipeline import SequentialPipelineBlock
|
|
| 16 |
from diffusers.modular_pipelines.minimax_h3.modular_blocks_minimax_h3 import (
|
| 17 |
MiniMaxH3DecodeStep,
|
| 18 |
MiniMaxH3Ref2VACoreDenoiseStep,
|
| 19 |
-
_generation_outputs,
|
| 20 |
)
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
class MiniMaxH3Ref2VAGeneratorBlocks(SequentialPipelineBlocks):
|
|
@@ -47,4 +49,14 @@ class MiniMaxH3Ref2VAGeneratorBlocks(SequentialPipelineBlocks):
|
|
| 47 |
|
| 48 |
@property
|
| 49 |
def outputs(self):
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
subclass against the same diffusers classes.
|
| 10 |
"""
|
| 11 |
|
| 12 |
+
import torch
|
| 13 |
+
|
| 14 |
from diffusers.modular_pipelines.minimax_h3.before_encoder import MiniMaxH3Ref2VASetupStep
|
| 15 |
from diffusers.modular_pipelines.minimax_h3.decoders import MiniMaxH3AfterDenoiseStep
|
| 16 |
from diffusers.modular_pipelines.minimax_h3.encoders import MiniMaxH3Ref2VAReferenceEncoderStep
|
|
|
|
| 18 |
from diffusers.modular_pipelines.minimax_h3.modular_blocks_minimax_h3 import (
|
| 19 |
MiniMaxH3DecodeStep,
|
| 20 |
MiniMaxH3Ref2VACoreDenoiseStep,
|
|
|
|
| 21 |
)
|
| 22 |
+
from diffusers.modular_pipelines.modular_pipeline_utils import OutputParam
|
| 23 |
|
| 24 |
|
| 25 |
class MiniMaxH3Ref2VAGeneratorBlocks(SequentialPipelineBlocks):
|
|
|
|
| 49 |
|
| 50 |
@property
|
| 51 |
def outputs(self):
|
| 52 |
+
# Inlined from `MiniMaxH3Blocks.outputs` (diffusers 0.41.0): the pre-merge PR exposed this list through a
|
| 53 |
+
# `_generation_outputs()` helper that the release dropped, so the same three params are spelled out here.
|
| 54 |
+
return [
|
| 55 |
+
OutputParam.template("videos", description="The generated video."),
|
| 56 |
+
OutputParam(
|
| 57 |
+
"audio",
|
| 58 |
+
type_hint=torch.Tensor,
|
| 59 |
+
description="The generated soundtrack, of shape `(1, 2, num_samples)`.",
|
| 60 |
+
),
|
| 61 |
+
OutputParam("sampling_rate", type_hint=int, description="Sample rate of the generated soundtrack in Hz."),
|
| 62 |
+
]
|