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
ec1c7a79
Unverified
Commit
ec1c7a79
authored
Dec 17, 2024
by
hlky
Committed by
GitHub
Dec 17, 2024
Browse files
Add `set_shift` to FlowMatchEulerDiscreteScheduler (#10269)
parent
9c68c945
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py
...fusers/schedulers/scheduling_flow_match_euler_discrete.py
+13
-1
No files found.
src/diffusers/schedulers/scheduling_flow_match_euler_discrete.py
View file @
ec1c7a79
...
...
@@ -99,10 +99,19 @@ class FlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigMixin):
self
.
_step_index
=
None
self
.
_begin_index
=
None
self
.
_shift
=
shift
self
.
sigmas
=
sigmas
.
to
(
"cpu"
)
# to avoid too much CPU/GPU communication
self
.
sigma_min
=
self
.
sigmas
[
-
1
].
item
()
self
.
sigma_max
=
self
.
sigmas
[
0
].
item
()
@
property
def
shift
(
self
):
"""
The value used for shifting.
"""
return
self
.
_shift
@
property
def
step_index
(
self
):
"""
...
...
@@ -128,6 +137,9 @@ class FlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigMixin):
"""
self
.
_begin_index
=
begin_index
def
set_shift
(
self
,
shift
:
float
):
self
.
_shift
=
shift
def
scale_noise
(
self
,
sample
:
torch
.
FloatTensor
,
...
...
@@ -236,7 +248,7 @@ class FlowMatchEulerDiscreteScheduler(SchedulerMixin, ConfigMixin):
if
self
.
config
.
use_dynamic_shifting
:
sigmas
=
self
.
time_shift
(
mu
,
1.0
,
sigmas
)
else
:
sigmas
=
self
.
config
.
shift
*
sigmas
/
(
1
+
(
self
.
config
.
shift
-
1
)
*
sigmas
)
sigmas
=
self
.
shift
*
sigmas
/
(
1
+
(
self
.
shift
-
1
)
*
sigmas
)
if
self
.
config
.
shift_terminal
:
sigmas
=
self
.
stretch_shift_to_terminal
(
sigmas
)
...
...
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