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
154a7865
Unverified
Commit
154a7865
authored
Feb 04, 2023
by
Pedro Cuenca
Committed by
GitHub
Feb 04, 2023
Browse files
[Flax DDPM] Make `key` optional so default pipelines don't fail (#2176)
Make `key` optional so default pipelines don't fail.
parent
9baa29e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/diffusers/schedulers/scheduling_ddpm_flax.py
src/diffusers/schedulers/scheduling_ddpm_flax.py
+4
-1
No files found.
src/diffusers/schedulers/scheduling_ddpm_flax.py
View file @
154a7865
...
@@ -198,7 +198,7 @@ class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin):
...
@@ -198,7 +198,7 @@ class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin):
model_output
:
jnp
.
ndarray
,
model_output
:
jnp
.
ndarray
,
timestep
:
int
,
timestep
:
int
,
sample
:
jnp
.
ndarray
,
sample
:
jnp
.
ndarray
,
key
:
jax
.
random
.
KeyArray
,
key
:
Optional
[
jax
.
random
.
KeyArray
]
=
None
,
return_dict
:
bool
=
True
,
return_dict
:
bool
=
True
,
)
->
Union
[
FlaxDDPMSchedulerOutput
,
Tuple
]:
)
->
Union
[
FlaxDDPMSchedulerOutput
,
Tuple
]:
"""
"""
...
@@ -221,6 +221,9 @@ class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin):
...
@@ -221,6 +221,9 @@ class FlaxDDPMScheduler(FlaxSchedulerMixin, ConfigMixin):
"""
"""
t
=
timestep
t
=
timestep
if
key
is
None
:
key
=
jax
.
random
.
PRNGKey
(
0
)
if
model_output
.
shape
[
1
]
==
sample
.
shape
[
1
]
*
2
and
self
.
config
.
variance_type
in
[
"learned"
,
"learned_range"
]:
if
model_output
.
shape
[
1
]
==
sample
.
shape
[
1
]
*
2
and
self
.
config
.
variance_type
in
[
"learned"
,
"learned_range"
]:
model_output
,
predicted_variance
=
jnp
.
split
(
model_output
,
sample
.
shape
[
1
],
axis
=
1
)
model_output
,
predicted_variance
=
jnp
.
split
(
model_output
,
sample
.
shape
[
1
],
axis
=
1
)
else
:
else
:
...
...
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