MCPcopy Create free account
hub / github.com/Alpha-VLLM/LLaMA2-Accessory / encode_image

Method encode_image

accessory/model/LLM/llama.py:364–370  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

362
363
364 def encode_image(self, image):
365 with torch.cuda.amp.autocast(enabled=False):
366 image = image.half()
367 image_tokens = self.clip_encode_image(image)
368 image = image.to(self.clip_proj.weight.dtype)
369 image_tokens = self.clip_proj_norm(self.clip_proj(image_tokens))
370 return image_tokens
371
372
373 def forward(self, examples, image=None):

Callers 4

forwardMethod · 0.95
forward_inferenceMethod · 0.95
forwardMethod · 0.95
forward_inferenceMethod · 0.95

Calls 1

clip_encode_imageMethod · 0.95

Tested by

no test coverage detected