Does Llama 3.2 vision use CLIP? #2462
-
2 questions really:
flowchart LR
vision["{image}"] --> clipT[CLIP Transformer]
clipT --> t[t Transformer]
t --> cat[cat along feature dim]
clipT -- "hidden state 1" --> cat
clipT -- "hidden state 2" --> cat
clipT -- "hidden state 3" --> cat
cat --> MLP
MLP -- "cross attention" --> decoder[Decoder]
text["{text}"] --> decoder
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Beta Was this translation helpful? Give feedback.
-
@vedantroy As I understood from the Llama 3 paper (around page 56). The authors took a version of the original ViT Model (vanilla vision transformers). Then trained it with image-text pair again for text supervision and that encoder was used for the multimodal Llama 3. |
Beta Was this translation helpful? Give feedback.
The base vision encoder in Llama3.2 is a variant of OpenAI CLIP. So we implement the generic model and then in the Llama3.2 encoder builder use the hyperparameters used by the Llama team and not the original CLIP model. The Llama CLIP is pre-trained in the same way as OpenAI CLIP and then further post trained with end to end with the encoder head and decoder.
The diagram looks good where I'm assuming that "t Transformer" is the transformer inside of Llama3VisionProjectionHead. Also the cross attention with the decoder only happens on certain layers of the decoder. If you want to dig even deeper into how it works you can look at how images get broken into tiles which CLIP converts into…