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
3f75419e
Commit
3f75419e
authored
Mar 07, 2024
by
comfyanonymous
Browse files
Add a node to use the super resolution controlnet.
parent
5f60ee24
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
comfy_extras/nodes_stable_cascade.py
comfy_extras/nodes_stable_cascade.py
+31
-0
No files found.
comfy_extras/nodes_stable_cascade.py
View file @
3f75419e
...
...
@@ -102,8 +102,39 @@ class StableCascade_StageB_Conditioning:
c
.
append
(
n
)
return
(
c
,
)
class
StableCascade_SuperResolutionControlnet
:
def
__init__
(
self
,
device
=
"cpu"
):
self
.
device
=
device
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"image"
:
(
"IMAGE"
,),
"vae"
:
(
"VAE"
,
),
}}
RETURN_TYPES
=
(
"IMAGE"
,
"LATENT"
,
"LATENT"
)
RETURN_NAMES
=
(
"controlnet_input"
,
"stage_c"
,
"stage_b"
)
FUNCTION
=
"generate"
CATEGORY
=
"_for_testing/stable_cascade"
def
generate
(
self
,
image
,
vae
):
width
=
image
.
shape
[
-
2
]
height
=
image
.
shape
[
-
3
]
batch_size
=
image
.
shape
[
0
]
controlnet_input
=
vae
.
encode
(
image
[:,:,:,:
3
]).
movedim
(
1
,
-
1
)
c_latent
=
torch
.
zeros
([
batch_size
,
16
,
height
//
16
,
width
//
16
])
b_latent
=
torch
.
zeros
([
batch_size
,
4
,
height
//
2
,
width
//
2
])
return
(
controlnet_input
,
{
"samples"
:
c_latent
,
},
{
"samples"
:
b_latent
,
})
NODE_CLASS_MAPPINGS
=
{
"StableCascade_EmptyLatentImage"
:
StableCascade_EmptyLatentImage
,
"StableCascade_StageB_Conditioning"
:
StableCascade_StageB_Conditioning
,
"StableCascade_StageC_VAEEncode"
:
StableCascade_StageC_VAEEncode
,
"StableCascade_SuperResolutionControlnet"
:
StableCascade_SuperResolutionControlnet
,
}
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