Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
diffusers
Commits
8842bcad
Unverified
Commit
8842bcad
authored
Jan 16, 2024
by
Yondon Fu
Committed by
GitHub
Jan 16, 2024
Browse files
[SVD] Return np.ndarray when output_type="np" (#6507)
[SVD] Fix output_type="np"
parent
181280ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py
...stable_video_diffusion/pipeline_stable_video_diffusion.py
+3
-0
tests/pipelines/stable_video_diffusion/test_stable_video_diffusion.py
...nes/stable_video_diffusion/test_stable_video_diffusion.py
+17
-0
No files found.
src/diffusers/pipelines/stable_video_diffusion/pipeline_stable_video_diffusion.py
View file @
8842bcad
...
@@ -52,6 +52,9 @@ def tensor2vid(video: torch.Tensor, processor, output_type="np"):
...
@@ -52,6 +52,9 @@ def tensor2vid(video: torch.Tensor, processor, output_type="np"):
outputs
.
append
(
batch_output
)
outputs
.
append
(
batch_output
)
if
output_type
==
"np"
:
return
np
.
stack
(
outputs
)
return
outputs
return
outputs
...
...
tests/pipelines/stable_video_diffusion/test_stable_video_diffusion.py
View file @
8842bcad
...
@@ -185,6 +185,23 @@ class StableVideoDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCa
...
@@ -185,6 +185,23 @@ class StableVideoDiffusionPipelineFastTests(PipelineTesterMixin, unittest.TestCa
def
test_inference_batch_consistent
(
self
):
def
test_inference_batch_consistent
(
self
):
pass
pass
def
test_np_output_type
(
self
):
components
=
self
.
get_dummy_components
()
pipe
=
self
.
pipeline_class
(
**
components
)
for
component
in
pipe
.
components
.
values
():
if
hasattr
(
component
,
"set_default_attn_processor"
):
component
.
set_default_attn_processor
()
pipe
.
to
(
torch_device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
generator_device
=
"cpu"
inputs
=
self
.
get_dummy_inputs
(
generator_device
)
inputs
[
"output_type"
]
=
"np"
output
=
pipe
(
**
inputs
).
frames
self
.
assertTrue
(
isinstance
(
output
,
np
.
ndarray
))
self
.
assertEqual
(
len
(
output
.
shape
),
5
)
def
test_dict_tuple_outputs_equivalent
(
self
,
expected_max_difference
=
1e-4
):
def
test_dict_tuple_outputs_equivalent
(
self
,
expected_max_difference
=
1e-4
):
components
=
self
.
get_dummy_components
()
components
=
self
.
get_dummy_components
()
pipe
=
self
.
pipeline_class
(
**
components
)
pipe
=
self
.
pipeline_class
(
**
components
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment