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
chenpangpang
ComfyUI
Commits
d7897fff
"ppocr/git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "631fd9fdeccfa79b67611d770027f8ae89d1f63f"
Commit
d7897fff
authored
Mar 16, 2024
by
comfyanonymous
Browse files
Move cascade scale factor from stage_a to latent_formats.py
parent
f2fe635c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
comfy/latent_formats.py
comfy/latent_formats.py
+1
-1
comfy/ldm/cascade/stage_a.py
comfy/ldm/cascade/stage_a.py
+3
-6
No files found.
comfy/latent_formats.py
View file @
d7897fff
...
@@ -95,7 +95,7 @@ class SC_Prior(LatentFormat):
...
@@ -95,7 +95,7 @@ class SC_Prior(LatentFormat):
class
SC_B
(
LatentFormat
):
class
SC_B
(
LatentFormat
):
def
__init__
(
self
):
def
__init__
(
self
):
self
.
scale_factor
=
1.0
self
.
scale_factor
=
1.0
/
0.43
self
.
latent_rgb_factors
=
[
self
.
latent_rgb_factors
=
[
[
0.1121
,
0.2006
,
0.1023
],
[
0.1121
,
0.2006
,
0.1023
],
[
-
0.2093
,
-
0.0222
,
-
0.0195
],
[
-
0.2093
,
-
0.0222
,
-
0.0195
],
...
...
comfy/ldm/cascade/stage_a.py
View file @
d7897fff
...
@@ -163,11 +163,9 @@ class ResBlock(nn.Module):
...
@@ -163,11 +163,9 @@ class ResBlock(nn.Module):
class
StageA
(
nn
.
Module
):
class
StageA
(
nn
.
Module
):
def
__init__
(
self
,
levels
=
2
,
bottleneck_blocks
=
12
,
c_hidden
=
384
,
c_latent
=
4
,
codebook_size
=
8192
,
def
__init__
(
self
,
levels
=
2
,
bottleneck_blocks
=
12
,
c_hidden
=
384
,
c_latent
=
4
,
codebook_size
=
8192
):
scale_factor
=
0.43
):
# 0.3764
super
().
__init__
()
super
().
__init__
()
self
.
c_latent
=
c_latent
self
.
c_latent
=
c_latent
self
.
scale_factor
=
scale_factor
c_levels
=
[
c_hidden
//
(
2
**
i
)
for
i
in
reversed
(
range
(
levels
))]
c_levels
=
[
c_hidden
//
(
2
**
i
)
for
i
in
reversed
(
range
(
levels
))]
# Encoder blocks
# Encoder blocks
...
@@ -214,12 +212,11 @@ class StageA(nn.Module):
...
@@ -214,12 +212,11 @@ class StageA(nn.Module):
x
=
self
.
down_blocks
(
x
)
x
=
self
.
down_blocks
(
x
)
if
quantize
:
if
quantize
:
qe
,
(
vq_loss
,
commit_loss
),
indices
=
self
.
vquantizer
.
forward
(
x
,
dim
=
1
)
qe
,
(
vq_loss
,
commit_loss
),
indices
=
self
.
vquantizer
.
forward
(
x
,
dim
=
1
)
return
qe
/
self
.
scale_factor
,
x
/
self
.
scale_factor
,
indices
,
vq_loss
+
commit_loss
*
0.25
return
qe
,
x
,
indices
,
vq_loss
+
commit_loss
*
0.25
else
:
else
:
return
x
/
self
.
scale_factor
return
x
def
decode
(
self
,
x
):
def
decode
(
self
,
x
):
x
=
x
*
self
.
scale_factor
x
=
self
.
up_blocks
(
x
)
x
=
self
.
up_blocks
(
x
)
x
=
self
.
out_block
(
x
)
x
=
self
.
out_block
(
x
)
return
x
return
x
...
...
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