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
35e92096
Unverified
Commit
35e92096
authored
Sep 24, 2022
by
Grigory Sizov
Committed by
GitHub
Sep 24, 2022
Browse files
Fix formula for noise levels in Karras scheduler and tests (#627)
fix formula for noise levels in karras scheduler and tests
parent
d0aa899f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
src/diffusers/schedulers/scheduling_karras_ve.py
src/diffusers/schedulers/scheduling_karras_ve.py
+1
-1
src/diffusers/schedulers/scheduling_karras_ve_flax.py
src/diffusers/schedulers/scheduling_karras_ve_flax.py
+1
-1
tests/test_pipelines.py
tests/test_pipelines.py
+1
-1
No files found.
src/diffusers/schedulers/scheduling_karras_ve.py
View file @
35e92096
...
@@ -110,7 +110,7 @@ class KarrasVeScheduler(SchedulerMixin, ConfigMixin):
...
@@ -110,7 +110,7 @@ class KarrasVeScheduler(SchedulerMixin, ConfigMixin):
self
.
timesteps
=
np
.
arange
(
0
,
self
.
num_inference_steps
)[::
-
1
].
copy
()
self
.
timesteps
=
np
.
arange
(
0
,
self
.
num_inference_steps
)[::
-
1
].
copy
()
self
.
schedule
=
[
self
.
schedule
=
[
(
(
self
.
config
.
sigma_max
self
.
config
.
sigma_max
**
2
*
(
self
.
config
.
sigma_min
**
2
/
self
.
config
.
sigma_max
**
2
)
**
(
i
/
(
num_inference_steps
-
1
))
*
(
self
.
config
.
sigma_min
**
2
/
self
.
config
.
sigma_max
**
2
)
**
(
i
/
(
num_inference_steps
-
1
))
)
)
for
i
in
self
.
timesteps
for
i
in
self
.
timesteps
...
...
src/diffusers/schedulers/scheduling_karras_ve_flax.py
View file @
35e92096
...
@@ -113,7 +113,7 @@ class FlaxKarrasVeScheduler(SchedulerMixin, ConfigMixin):
...
@@ -113,7 +113,7 @@ class FlaxKarrasVeScheduler(SchedulerMixin, ConfigMixin):
timesteps
=
jnp
.
arange
(
0
,
num_inference_steps
)[::
-
1
].
copy
()
timesteps
=
jnp
.
arange
(
0
,
num_inference_steps
)[::
-
1
].
copy
()
schedule
=
[
schedule
=
[
(
(
self
.
config
.
sigma_max
self
.
config
.
sigma_max
**
2
*
(
self
.
config
.
sigma_min
**
2
/
self
.
config
.
sigma_max
**
2
)
**
(
i
/
(
num_inference_steps
-
1
))
*
(
self
.
config
.
sigma_min
**
2
/
self
.
config
.
sigma_max
**
2
)
**
(
i
/
(
num_inference_steps
-
1
))
)
)
for
i
in
timesteps
for
i
in
timesteps
...
...
tests/test_pipelines.py
View file @
35e92096
...
@@ -1104,7 +1104,7 @@ class PipelineTesterMixin(unittest.TestCase):
...
@@ -1104,7 +1104,7 @@ class PipelineTesterMixin(unittest.TestCase):
image_slice
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
image_slice
=
image
[
0
,
-
3
:,
-
3
:,
-
1
]
assert
image
.
shape
==
(
1
,
256
,
256
,
3
)
assert
image
.
shape
==
(
1
,
256
,
256
,
3
)
expected_slice
=
np
.
array
([
0.
26815
,
0.
1
581
,
0.
2658
,
0.23248
,
0.1550
,
0.2539
,
0.
113
1
,
0.
1
02
4
,
0.
0837
])
expected_slice
=
np
.
array
([
0.
578
,
0.581
1
,
0.
5924
,
0.5809
,
0.587
,
0.5886
,
0.
586
1
,
0.
58
02
,
0.
586
])
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
assert
np
.
abs
(
image_slice
.
flatten
()
-
expected_slice
).
max
()
<
1e-2
@
slow
@
slow
...
...
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