Skip to content

Commit 996cffd

Browse files
committed
add output type
1 parent 5ffc621 commit 996cffd

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/diffusers/modular_pipelines/mellon_node_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ def _name_to_label(name: str) -> str:
156156
"display": "slider",
157157
"required_block_params": ["layers"],
158158
},
159+
"output_type": {
160+
"label": "Output Type",
161+
"type": "dropdown",
162+
"default": "np",
163+
"options": ["np", "pil", "pt"],
164+
},
159165
# ControlNet
160166
"controlnet_conditioning_scale": {
161167
"label": "Controlnet Conditioning Scale",

src/diffusers/modular_pipelines/wan/decoders.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ def inputs(self) -> List[Tuple[str, Any]]:
5656
required=True,
5757
type_hint=torch.Tensor,
5858
description="The denoised latents from the denoising step",
59-
)
59+
),
60+
InputParam(
61+
"output_type", default="np", type_hint=str, description="The output type of the decoded videos"
62+
),
6063
]
6164

6265
@property
@@ -87,7 +90,8 @@ def __call__(self, components, state: PipelineState) -> PipelineState:
8790
latents = latents.to(vae_dtype)
8891
block_state.videos = components.vae.decode(latents, return_dict=False)[0]
8992

90-
block_state.videos = components.video_processor.postprocess_video(block_state.videos, output_type="np")
93+
output_type = getattr(block_state, "output_type", "np")
94+
block_state.videos = components.video_processor.postprocess_video(block_state.videos, output_type=output_type)
9195

9296
self.set_block_state(state, block_state)
9397

0 commit comments

Comments
 (0)