FlagOpen / FlagEmbedding

Retrieval and Retrieval-augmented LLMs
MIT License
6.71k stars 480 forks source link

Does visualized bge support the embedding of multiple pictures and one text? #967

Open babytdream opened 1 month ago

babytdream commented 1 month ago

A data include some pictures and a text. Like: image1,image2,image3 and a text. Can I use visualized bge? How to use, thank you!

def encode(self, image=None, text=None):
        # used for simple inference
        if image is not None:
            image = self.preprocess_val(Image.open(image)).unsqueeze(0)

            if text is not None:
                text = self.tokenizer(text, return_tensors="pt", padding=True)
                return self.encode_mm(image.to(self.device), text.to(self.device))
            else:
                return self.encode_image(image.to(self.device))
        else:
            if text is not None:
                text = self.tokenizer(text, return_tensors="pt", padding=True)
                return self.encode_text(text.to(self.device))
            else:
                return None
JUNJIE99 commented 1 month ago

Hello, Visualized BGE currently does not support multiple image input.