[GH-ISSUE #119] training clip #107

Closed
opened 2026-10-31 21:11:14 +00:00 by bsakaguchi · 4 comments
Owner

Originally created by @LilyTheBear on GitHub (Jun 21, 2021).
Original GitHub issue: https://github.com/openai/CLIP/issues/119

Hi,
would you mind to explain the size, dimension and the format of input sensors for training ? or provide an example ?

best

Niloo

Originally created by @LilyTheBear on GitHub (Jun 21, 2021). Original GitHub issue: https://github.com/openai/CLIP/issues/119 Hi, would you mind to explain the size, dimension and the format of input sensors for training ? or provide an example ? best Niloo
Author
Owner

@vinson2233 commented on GitHub (Jun 22, 2021):

Have you seen this thread? https://github.com/openai/CLIP/issues/83
Image is PIL format, it can be in any size, the preprocess object from CLIP will handle the resize. If your image composed in 4 change (RGBA), put .convert('RGB') after PIL image reading.

The text is just list of string. The ideal size is <= 77 characters.

<!-- gh-comment-id:865490013 --> @vinson2233 commented on GitHub (Jun 22, 2021): Have you seen this thread? https://github.com/openai/CLIP/issues/83 Image is PIL format, it can be in any size, the `preprocess` object from CLIP will handle the resize. If your image composed in 4 change (RGBA), put `.convert('RGB')` after PIL image reading. The text is just list of string. The ideal size is <= 77 characters.
Author
Owner

@jongwook commented on GitHub (Jun 30, 2021):

@vinson2233 's example in #83 basically does it (thank you!).

Some details: grayscale (1 channel) or RGBA (4 channels) images are converted to 3-channel RGB images by the CLIP preprocessor (this line). The tokenizer will produce about 1-3 tokens from each word, so 77 tokens is often lot longer than 77 characters.

<!-- gh-comment-id:871780446 --> @jongwook commented on GitHub (Jun 30, 2021): @vinson2233 's example in #83 basically does it (thank you!). Some details: grayscale (1 channel) or RGBA (4 channels) images are converted to 3-channel RGB images by the CLIP preprocessor ([this line](https://github.com/openai/CLIP/blob/main/clip/clip.py#L62)). The tokenizer will produce about 1-3 tokens from each word, so 77 tokens is often lot longer than 77 characters.
Author
Owner

@vinson2233 commented on GitHub (Jul 1, 2021):

@jongwook i see, thanks for the explanation.

<!-- gh-comment-id:871879072 --> @vinson2233 commented on GitHub (Jul 1, 2021): @jongwook i see, thanks for the explanation.
Author
Owner

@MonolithFoundation commented on GitHub (Feb 13, 2025):

@jongwook hi, how to do this in hf's CLIPImageProcessor?

github.com/openai/CLIP@dcba3cb2e2/clip/clip.py (L76)

<!-- gh-comment-id:2655292455 --> @MonolithFoundation commented on GitHub (Feb 13, 2025): @jongwook hi, how to do this in hf's CLIPImageProcessor? https://github.com/openai/CLIP/blob/dcba3cb2e2827b402d2701e7e1c7d9fed8a20ef1/clip/clip.py#L76
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openai/CLIP#107
No description provided.