Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
0c6d1bc9
Unverified
Commit
0c6d1bc9
authored
Jun 22, 2023
by
Robert Dargavel Smith
Committed by
GitHub
Jun 22, 2023
Browse files
fix audio_diffusion tests (#3850)
parent
13e781f9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
tests/pipelines/audio_diffusion/test_audio_diffusion.py
tests/pipelines/audio_diffusion/test_audio_diffusion.py
+12
-2
No files found.
tests/pipelines/audio_diffusion/test_audio_diffusion.py
View file @
0c6d1bc9
...
...
@@ -99,7 +99,10 @@ class PipelineFastTests(unittest.TestCase):
@
slow
def
test_audio_diffusion
(
self
):
device
=
"cpu"
# ensure determinism for the device-dependent torch.Generator
mel
=
Mel
()
mel
=
Mel
(
x_res
=
self
.
dummy_unet
.
config
.
sample_size
[
1
],
y_res
=
self
.
dummy_unet
.
config
.
sample_size
[
0
],
)
scheduler
=
DDPMScheduler
()
pipe
=
AudioDiffusionPipeline
(
vqvae
=
None
,
unet
=
self
.
dummy_unet
,
mel
=
mel
,
scheduler
=
scheduler
)
...
...
@@ -127,6 +130,11 @@ class PipelineFastTests(unittest.TestCase):
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
==
0
assert
np
.
abs
(
image_from_tuple_slice
.
flatten
()
-
expected_slice
).
max
()
==
0
mel
=
Mel
(
x_res
=
self
.
dummy_vqvae_and_unet
[
0
].
config
.
sample_size
[
1
],
y_res
=
self
.
dummy_vqvae_and_unet
[
0
].
config
.
sample_size
[
0
],
)
scheduler
=
DDIMScheduler
()
dummy_vqvae_and_unet
=
self
.
dummy_vqvae_and_unet
pipe
=
AudioDiffusionPipeline
(
...
...
@@ -154,13 +162,15 @@ class PipelineFastTests(unittest.TestCase):
pipe
=
AudioDiffusionPipeline
(
vqvae
=
self
.
dummy_vqvae_and_unet
[
0
],
unet
=
dummy_unet_condition
,
mel
=
mel
,
scheduler
=
scheduler
)
pipe
=
pipe
.
to
(
device
)
pipe
.
set_progress_bar_config
(
disable
=
None
)
np
.
random
.
seed
(
0
)
encoding
=
torch
.
rand
((
1
,
1
,
10
))
output
=
pipe
(
generator
=
generator
,
encoding
=
encoding
)
image
=
output
.
images
[
0
]
image_slice
=
np
.
frombuffer
(
image
.
tobytes
(),
dtype
=
"uint8"
)[:
10
]
expected_slice
=
np
.
array
([
1
2
0
,
13
9
,
1
47
,
12
3
,
1
24
,
96
,
11
5
,
12
1
,
126
,
1
44
])
expected_slice
=
np
.
array
([
10
7
,
1
0
3
,
1
20
,
12
7
,
1
42
,
122
,
11
3
,
12
2
,
97
,
1
11
])
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
==
0
...
...
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