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
7ec1dd25
Commit
7ec1dd25
authored
Mar 06, 2023
by
comfyanonymous
Browse files
A tiny bit of reorganizing.
parent
47acb3d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
comfy_extras/clip_vision_config.json
comfy_extras/clip_vision_config.json
+23
-0
nodes.py
nodes.py
+12
-12
No files found.
comfy_extras/clip_vision_config.json
0 → 100644
View file @
7ec1dd25
{
"_name_or_path"
:
"openai/clip-vit-large-patch14"
,
"architectures"
:
[
"CLIPVisionModel"
],
"attention_dropout"
:
0.0
,
"dropout"
:
0.0
,
"hidden_act"
:
"quick_gelu"
,
"hidden_size"
:
1024
,
"image_size"
:
224
,
"initializer_factor"
:
1.0
,
"initializer_range"
:
0.02
,
"intermediate_size"
:
4096
,
"layer_norm_eps"
:
1e-05
,
"model_type"
:
"clip_vision_model"
,
"num_attention_heads"
:
16
,
"num_channels"
:
3
,
"num_hidden_layers"
:
24
,
"patch_size"
:
14
,
"projection_dim"
:
768
,
"torch_dtype"
:
"float32"
,
"transformers_version"
:
"4.24.0"
}
nodes.py
View file @
7ec1dd25
...
@@ -395,10 +395,10 @@ class CLIPVisionEncode:
...
@@ -395,10 +395,10 @@ class CLIPVisionEncode:
return
{
"required"
:
{
"clip_vision"
:
(
"CLIP_VISION"
,),
return
{
"required"
:
{
"clip_vision"
:
(
"CLIP_VISION"
,),
"image"
:
(
"IMAGE"
,)
"image"
:
(
"IMAGE"
,)
}}
}}
RETURN_TYPES
=
(
"CLIP_VISION_
EMBED
"
,)
RETURN_TYPES
=
(
"CLIP_VISION_
OUTPUT
"
,)
FUNCTION
=
"encode"
FUNCTION
=
"encode"
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning
/style_model
"
def
encode
(
self
,
clip_vision
,
image
):
def
encode
(
self
,
clip_vision
,
image
):
output
=
clip_vision
.
encode_image
(
image
)
output
=
clip_vision
.
encode_image
(
image
)
...
@@ -425,16 +425,16 @@ class StyleModelLoader:
...
@@ -425,16 +425,16 @@ class StyleModelLoader:
class
StyleModelApply
:
class
StyleModelApply
:
@
classmethod
@
classmethod
def
INPUT_TYPES
(
s
):
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"clip_vision_
embed
"
:
(
"CLIP_VISION_
EMBED
"
,
),
return
{
"required"
:
{
"clip_vision_
output
"
:
(
"CLIP_VISION_
OUTPUT
"
,
),
"style_model"
:
(
"STYLE_MODEL"
,
)
"style_model"
:
(
"STYLE_MODEL"
,
)
}}
}}
RETURN_TYPES
=
(
"CONDITIONING"
,)
RETURN_TYPES
=
(
"CONDITIONING"
,)
FUNCTION
=
"apply_stylemodel"
FUNCTION
=
"apply_stylemodel"
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning
/style_model
"
def
apply_stylemodel
(
self
,
clip_vision_
embed
,
style_model
):
def
apply_stylemodel
(
self
,
clip_vision_
output
,
style_model
):
c
=
style_model
.
get_cond
(
clip_vision_
embed
)
c
=
style_model
.
get_cond
(
clip_vision_
output
)
return
([[
c
,
{}]],
)
return
([[
c
,
{}]],
)
...
@@ -445,7 +445,7 @@ class ConditioningAppend:
...
@@ -445,7 +445,7 @@ class ConditioningAppend:
RETURN_TYPES
=
(
"CONDITIONING"
,)
RETURN_TYPES
=
(
"CONDITIONING"
,)
FUNCTION
=
"append"
FUNCTION
=
"append"
CATEGORY
=
"conditioning"
CATEGORY
=
"conditioning
/style_model
"
def
append
(
self
,
conditioning_to
,
conditioning_from
):
def
append
(
self
,
conditioning_to
,
conditioning_from
):
c
=
[]
c
=
[]
...
@@ -504,7 +504,7 @@ class LatentRotate:
...
@@ -504,7 +504,7 @@ class LatentRotate:
RETURN_TYPES
=
(
"LATENT"
,)
RETURN_TYPES
=
(
"LATENT"
,)
FUNCTION
=
"rotate"
FUNCTION
=
"rotate"
CATEGORY
=
"latent"
CATEGORY
=
"latent
/transform
"
def
rotate
(
self
,
samples
,
rotation
):
def
rotate
(
self
,
samples
,
rotation
):
s
=
samples
.
copy
()
s
=
samples
.
copy
()
...
@@ -528,7 +528,7 @@ class LatentFlip:
...
@@ -528,7 +528,7 @@ class LatentFlip:
RETURN_TYPES
=
(
"LATENT"
,)
RETURN_TYPES
=
(
"LATENT"
,)
FUNCTION
=
"flip"
FUNCTION
=
"flip"
CATEGORY
=
"latent"
CATEGORY
=
"latent
/transform
"
def
flip
(
self
,
samples
,
flip_method
):
def
flip
(
self
,
samples
,
flip_method
):
s
=
samples
.
copy
()
s
=
samples
.
copy
()
...
@@ -593,7 +593,7 @@ class LatentCrop:
...
@@ -593,7 +593,7 @@ class LatentCrop:
RETURN_TYPES
=
(
"LATENT"
,)
RETURN_TYPES
=
(
"LATENT"
,)
FUNCTION
=
"crop"
FUNCTION
=
"crop"
CATEGORY
=
"latent"
CATEGORY
=
"latent
/transform
"
def
crop
(
self
,
samples
,
width
,
height
,
x
,
y
):
def
crop
(
self
,
samples
,
width
,
height
,
x
,
y
):
s
=
samples
.
copy
()
s
=
samples
.
copy
()
...
@@ -951,8 +951,6 @@ NODE_CLASS_MAPPINGS = {
...
@@ -951,8 +951,6 @@ NODE_CLASS_MAPPINGS = {
"LatentCrop"
:
LatentCrop
,
"LatentCrop"
:
LatentCrop
,
"LoraLoader"
:
LoraLoader
,
"LoraLoader"
:
LoraLoader
,
"CLIPLoader"
:
CLIPLoader
,
"CLIPLoader"
:
CLIPLoader
,
"StyleModelLoader"
:
StyleModelLoader
,
"CLIPVisionLoader"
:
CLIPVisionLoader
,
"CLIPVisionEncode"
:
CLIPVisionEncode
,
"CLIPVisionEncode"
:
CLIPVisionEncode
,
"StyleModelApply"
:
StyleModelApply
,
"StyleModelApply"
:
StyleModelApply
,
"ConditioningAppend"
:
ConditioningAppend
,
"ConditioningAppend"
:
ConditioningAppend
,
...
@@ -960,6 +958,8 @@ NODE_CLASS_MAPPINGS = {
...
@@ -960,6 +958,8 @@ NODE_CLASS_MAPPINGS = {
"ControlNetLoader"
:
ControlNetLoader
,
"ControlNetLoader"
:
ControlNetLoader
,
"DiffControlNetLoader"
:
DiffControlNetLoader
,
"DiffControlNetLoader"
:
DiffControlNetLoader
,
"T2IAdapterLoader"
:
T2IAdapterLoader
,
"T2IAdapterLoader"
:
T2IAdapterLoader
,
"StyleModelLoader"
:
StyleModelLoader
,
"CLIPVisionLoader"
:
CLIPVisionLoader
,
"VAEDecodeTiled"
:
VAEDecodeTiled
,
"VAEDecodeTiled"
:
VAEDecodeTiled
,
}
}
...
...
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