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
6f7869f3
Commit
6f7869f3
authored
Jul 17, 2024
by
comfyanonymous
Browse files
Get clip vision image size from config.
parent
281ad42d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
comfy/clip_vision.py
comfy/clip_vision.py
+2
-1
No files found.
comfy/clip_vision.py
View file @
6f7869f3
...
@@ -34,6 +34,7 @@ class ClipVisionModel():
...
@@ -34,6 +34,7 @@ class ClipVisionModel():
with
open
(
json_config
)
as
f
:
with
open
(
json_config
)
as
f
:
config
=
json
.
load
(
f
)
config
=
json
.
load
(
f
)
self
.
image_size
=
config
.
get
(
"image_size"
,
224
)
self
.
load_device
=
comfy
.
model_management
.
text_encoder_device
()
self
.
load_device
=
comfy
.
model_management
.
text_encoder_device
()
offload_device
=
comfy
.
model_management
.
text_encoder_offload_device
()
offload_device
=
comfy
.
model_management
.
text_encoder_offload_device
()
self
.
dtype
=
comfy
.
model_management
.
text_encoder_dtype
(
self
.
load_device
)
self
.
dtype
=
comfy
.
model_management
.
text_encoder_dtype
(
self
.
load_device
)
...
@@ -50,7 +51,7 @@ class ClipVisionModel():
...
@@ -50,7 +51,7 @@ class ClipVisionModel():
def
encode_image
(
self
,
image
):
def
encode_image
(
self
,
image
):
comfy
.
model_management
.
load_model_gpu
(
self
.
patcher
)
comfy
.
model_management
.
load_model_gpu
(
self
.
patcher
)
pixel_values
=
clip_preprocess
(
image
.
to
(
self
.
load_device
)).
float
()
pixel_values
=
clip_preprocess
(
image
.
to
(
self
.
load_device
)
,
size
=
self
.
image_size
).
float
()
out
=
self
.
model
(
pixel_values
=
pixel_values
,
intermediate_output
=-
2
)
out
=
self
.
model
(
pixel_values
=
pixel_values
,
intermediate_output
=-
2
)
outputs
=
Output
()
outputs
=
Output
()
...
...
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