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
f1cb8074
Commit
f1cb8074
authored
Jun 30, 2022
by
patil-suraj
Browse files
remove get_act
parent
13ac40ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
16 deletions
+1
-16
src/diffusers/models/unet_sde_score_estimation.py
src/diffusers/models/unet_sde_score_estimation.py
+1
-16
No files found.
src/diffusers/models/unet_sde_score_estimation.py
View file @
f1cb8074
...
@@ -295,21 +295,6 @@ def conv2d(in_planes, out_planes, kernel_size=3, stride=1, bias=True, init_scale
...
@@ -295,21 +295,6 @@ def conv2d(in_planes, out_planes, kernel_size=3, stride=1, bias=True, init_scale
return
conv
return
conv
def
get_act
(
nonlinearity
):
"""Get activation functions from the config file."""
if
nonlinearity
.
lower
()
==
"elu"
:
return
nn
.
ELU
()
elif
nonlinearity
.
lower
()
==
"relu"
:
return
nn
.
ReLU
()
elif
nonlinearity
.
lower
()
==
"lrelu"
:
return
nn
.
LeakyReLU
(
negative_slope
=
0.2
)
elif
nonlinearity
.
lower
()
==
"swish"
:
return
nn
.
SiLU
()
else
:
raise
NotImplementedError
(
"activation function does not exist!"
)
def
variance_scaling
(
scale
=
1.0
,
in_axis
=
1
,
out_axis
=
0
,
dtype
=
torch
.
float32
,
device
=
"cpu"
):
def
variance_scaling
(
scale
=
1.0
,
in_axis
=
1
,
out_axis
=
0
,
dtype
=
torch
.
float32
,
device
=
"cpu"
):
"""Ported from JAX."""
"""Ported from JAX."""
scale
=
1e-10
if
scale
==
0
else
scale
scale
=
1e-10
if
scale
==
0
else
scale
...
@@ -467,7 +452,7 @@ class NCSNpp(ModelMixin, ConfigMixin):
...
@@ -467,7 +452,7 @@ class NCSNpp(ModelMixin, ConfigMixin):
skip_rescale
=
skip_rescale
,
skip_rescale
=
skip_rescale
,
continuous
=
continuous
,
continuous
=
continuous
,
)
)
self
.
act
=
act
=
get_act
(
nonlinearity
)
self
.
act
=
act
=
nn
.
SiLU
(
)
self
.
nf
=
nf
self
.
nf
=
nf
self
.
num_res_blocks
=
num_res_blocks
self
.
num_res_blocks
=
num_res_blocks
...
...
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