Skip to content

Commit

Permalink
Get clip vision image size from config.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Jul 17, 2024
1 parent 281ad42 commit 6f7869f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion comfy/clip_vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, json_config):
with open(json_config) as f:
config = json.load(f)

self.image_size = config.get("image_size", 224)
self.load_device = comfy.model_management.text_encoder_device()
offload_device = comfy.model_management.text_encoder_offload_device()
self.dtype = comfy.model_management.text_encoder_dtype(self.load_device)
Expand All @@ -50,7 +51,7 @@ def get_sd(self):

def encode_image(self, image):
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)

outputs = Output()
Expand Down

0 comments on commit 6f7869f

Please sign in to comment.