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
c96bfa5c
Unverified
Commit
c96bfa5c
authored
Nov 29, 2024
by
Sayak Paul
Committed by
GitHub
Nov 29, 2024
Browse files
[Mochi-1] ensuring to compute the fourier features in FP32 in Mochi encoder (#10031)
compute fourier features in FP32.
parent
6b288ec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
src/diffusers/models/autoencoders/autoencoder_kl_mochi.py
src/diffusers/models/autoencoders/autoencoder_kl_mochi.py
+3
-2
No files found.
src/diffusers/models/autoencoders/autoencoder_kl_mochi.py
View file @
c96bfa5c
...
...
@@ -437,7 +437,8 @@ class FourierFeatures(nn.Module):
def
forward
(
self
,
inputs
:
torch
.
Tensor
)
->
torch
.
Tensor
:
r
"""Forward method of the `FourierFeatures` class."""
original_dtype
=
inputs
.
dtype
inputs
=
inputs
.
to
(
torch
.
float32
)
num_channels
=
inputs
.
shape
[
1
]
num_freqs
=
(
self
.
stop
-
self
.
start
)
//
self
.
step
...
...
@@ -450,7 +451,7 @@ class FourierFeatures(nn.Module):
# Scale channels by frequency.
h
=
w
*
h
return
torch
.
cat
([
inputs
,
torch
.
sin
(
h
),
torch
.
cos
(
h
)],
dim
=
1
)
return
torch
.
cat
([
inputs
,
torch
.
sin
(
h
),
torch
.
cos
(
h
)],
dim
=
1
)
.
to
(
original_dtype
)
class
MochiEncoder3D
(
nn
.
Module
):
...
...
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