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
739d6ec7
Unverified
Commit
739d6ec7
authored
Mar 26, 2025
by
Junsong Chen
Committed by
GitHub
Mar 25, 2025
Browse files
add a timestep scale for sana-sprint teacher model (#11150)
parent
1ddf3f3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
src/diffusers/models/transformers/sana_transformer.py
src/diffusers/models/transformers/sana_transformer.py
+5
-0
src/diffusers/pipelines/sana/pipeline_sana.py
src/diffusers/pipelines/sana/pipeline_sana.py
+1
-0
No files found.
src/diffusers/models/transformers/sana_transformer.py
View file @
739d6ec7
...
...
@@ -326,6 +326,10 @@ class SanaTransformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, FromOrig
Whether to use elementwise affinity in the normalization layer.
norm_eps (`float`, defaults to `1e-6`):
The epsilon value for the normalization layer.
qk_norm (`str`, *optional*, defaults to `None`):
The normalization to use for the query and key.
timestep_scale (`float`, defaults to `1.0`):
The scale to use for the timesteps.
"""
_supports_gradient_checkpointing
=
True
...
...
@@ -355,6 +359,7 @@ class SanaTransformer2DModel(ModelMixin, ConfigMixin, PeftAdapterMixin, FromOrig
guidance_embeds
:
bool
=
False
,
guidance_embeds_scale
:
float
=
0.1
,
qk_norm
:
Optional
[
str
]
=
None
,
timestep_scale
:
float
=
1.0
,
)
->
None
:
super
().
__init__
()
...
...
src/diffusers/pipelines/sana/pipeline_sana.py
View file @
739d6ec7
...
...
@@ -938,6 +938,7 @@ class SanaPipeline(DiffusionPipeline, SanaLoraLoaderMixin):
# broadcast to batch dimension in a way that's compatible with ONNX/Core ML
timestep
=
t
.
expand
(
latent_model_input
.
shape
[
0
]).
to
(
latents
.
dtype
)
timestep
=
timestep
*
self
.
transformer
.
config
.
timestep_scale
# predict noise model_output
noise_pred
=
self
.
transformer
(
...
...
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