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

Method encode_image

accessory/model/LLM/mixtral_sparse.py:597–603  ·  view source on GitHub ↗
(self, image)

Source from the content-addressed store, hash-verified

595
596
597 def encode_image(self, image):
598 with torch.cuda.amp.autocast(enabled=False):
599 image = image.half()
600 image_tokens = self.clip_encode_image(image)
601 image = image.to(self.clip_proj.weight.dtype)
602 image_tokens = self.clip_proj_norm(self.clip_proj(image_tokens))
603 return image_tokens
604
605
606 def forward(self, examples, image=None):

Callers 2

forwardMethod · 0.95
forward_inferenceMethod · 0.95

Calls 1

clip_encode_imageMethod · 0.95

Tested by

no test coverage detected