Skip to content

Commit e2eed9e

Browse files
throw away alpha channel in clip vision preprocessor (Comfy-Org#7769)
saves users having to explicitly discard the channel
1 parent 11b68eb commit e2eed9e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

comfy/clip_vision.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __setitem__(self, key, item):
1818
setattr(self, key, item)
1919

2020
def clip_preprocess(image, size=224, mean=[0.48145466, 0.4578275, 0.40821073], std=[0.26862954, 0.26130258, 0.27577711], crop=True):
21+
image = image[:, :, :, :3] if image.shape[3] > 3 else image
2122
mean = torch.tensor(mean, device=image.device, dtype=image.dtype)
2223
std = torch.tensor(std, device=image.device, dtype=image.dtype)
2324
image = image.movedim(-1, 1)

0 commit comments

Comments
 (0)