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
f35387b3
Commit
f35387b3
authored
Jun 30, 2022
by
patil-suraj
Browse files
clean Linear
parent
3e2cff4d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
src/diffusers/models/unet_sde_score_estimation.py
src/diffusers/models/unet_sde_score_estimation.py
+9
-7
No files found.
src/diffusers/models/unet_sde_score_estimation.py
View file @
f35387b3
...
@@ -157,6 +157,13 @@ def Conv2d(in_planes, out_planes, kernel_size=3, stride=1, bias=True, init_scale
...
@@ -157,6 +157,13 @@ def Conv2d(in_planes, out_planes, kernel_size=3, stride=1, bias=True, init_scale
return
conv
return
conv
def
Linear
(
dim_in
,
dim_out
):
linear
=
nn
.
Linear
(
dim_in
,
dim_out
)
linear
.
weight
.
data
=
_variance_scaling
()(
linear
.
weight
.
shape
)
nn
.
init
.
zeros_
(
linear
.
bias
)
return
linear
class
Combine
(
nn
.
Module
):
class
Combine
(
nn
.
Module
):
"""Combine information from skip connections."""
"""Combine information from skip connections."""
...
@@ -296,13 +303,8 @@ class NCSNpp(ModelMixin, ConfigMixin):
...
@@ -296,13 +303,8 @@ class NCSNpp(ModelMixin, ConfigMixin):
else
:
else
:
raise
ValueError
(
f
"embedding type
{
embedding_type
}
unknown."
)
raise
ValueError
(
f
"embedding type
{
embedding_type
}
unknown."
)
if
conditional
:
modules
.
append
(
Linear
(
embed_dim
,
nf
*
4
))
modules
.
append
(
nn
.
Linear
(
embed_dim
,
nf
*
4
))
modules
.
append
(
Linear
(
nf
*
4
,
nf
*
4
))
modules
[
-
1
].
weight
.
data
=
_variance_scaling
()(
modules
[
-
1
].
weight
.
shape
)
nn
.
init
.
zeros_
(
modules
[
-
1
].
bias
)
modules
.
append
(
nn
.
Linear
(
nf
*
4
,
nf
*
4
))
modules
[
-
1
].
weight
.
data
=
_variance_scaling
()(
modules
[
-
1
].
weight
.
shape
)
nn
.
init
.
zeros_
(
modules
[
-
1
].
bias
)
AttnBlock
=
functools
.
partial
(
AttentionBlock
,
overwrite_linear
=
True
,
rescale_output_factor
=
math
.
sqrt
(
2.0
))
AttnBlock
=
functools
.
partial
(
AttentionBlock
,
overwrite_linear
=
True
,
rescale_output_factor
=
math
.
sqrt
(
2.0
))
Up_sample
=
functools
.
partial
(
FirUpsample
,
with_conv
=
resamp_with_conv
,
fir_kernel
=
fir_kernel
)
Up_sample
=
functools
.
partial
(
FirUpsample
,
with_conv
=
resamp_with_conv
,
fir_kernel
=
fir_kernel
)
...
...
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