Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
diffusers
Commits
7c4b38ba
Unverified
Commit
7c4b38ba
authored
Sep 14, 2022
by
Nicolas Patry
Committed by
GitHub
Sep 14, 2022
Browse files
Removing `.float()` (`autocast` in fp16 will discard this (I think)). (#495)
parent
ab7a78e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/diffusers/models/resnet.py
src/diffusers/models/resnet.py
+2
-2
No files found.
src/diffusers/models/resnet.py
View file @
7c4b38ba
...
...
@@ -333,7 +333,7 @@ class ResnetBlock2D(nn.Module):
# make sure hidden states is in float32
# when running in half-precision
hidden_states
=
self
.
norm1
(
hidden_states
.
float
()
).
type
(
hidden_states
.
dtype
)
hidden_states
=
self
.
norm1
(
hidden_states
).
type
(
hidden_states
.
dtype
)
hidden_states
=
self
.
nonlinearity
(
hidden_states
)
if
self
.
upsample
is
not
None
:
...
...
@@ -351,7 +351,7 @@ class ResnetBlock2D(nn.Module):
# make sure hidden states is in float32
# when running in half-precision
hidden_states
=
self
.
norm2
(
hidden_states
.
float
()
).
type
(
hidden_states
.
dtype
)
hidden_states
=
self
.
norm2
(
hidden_states
).
type
(
hidden_states
.
dtype
)
hidden_states
=
self
.
nonlinearity
(
hidden_states
)
hidden_states
=
self
.
dropout
(
hidden_states
)
...
...
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