Update README.md
Browse files26 unmodified lines272829303132331 unmodified line3536373839404142434445464726 unmodified linesnn.Linear(self.ebd_dim, fc_dim),nn.ReLU(),)self.score = nn.Linear(fc_dim, 5) # 5 classesdef forward(self, pixel_values, input_ids):outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)1 unmodified lineimage_text_embeds = self.head(image_text_embeds.view(-1, self.ebd_dim))# A classification model is based on embeddings from a generative model to leverage BLIP's powerful image-text encoding capabilities.logits = self.score(image_text_embeds)# generated text, probabilities of classificationreturn outputs, logitsmodel = BLIPNet()model.load_state_dict(torch.load("BLILP_Generation_Classification.bin"), strict=False)You need to input the sample in the same way as shown in the example provided at: https://huggingface.co/uf-aice-lab/BLIP-MathThen you can get the generated text and classification score simultaneously.26 unmodified lines272829303132331 unmodified line3536373839404142434445464726 unmodified linesnn.Linear(self.ebd_dim, fc_dim),nn.ReLU(),)self.output1= nn.Linear(fc_dim, 5) # 5 classesdef forward(self, pixel_values, input_ids):outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)1 unmodified lineimage_text_embeds = self.head(image_text_embeds.view(-1, self.ebd_dim))# A classification model is based on embeddings from a generative model to leverage BLIP's powerful image-text encoding capabilities.logits = self.output1(image_text_embeds)# generated text, probabilities of classificationreturn outputs, logitsmodel = BLIPNet()model.load_state_dict(torch.load("BLILP_Generation_Classification.bin"), strict=False)```pythonYou need to input the sample in the same way as shown in the example provided at: https://huggingface.co/uf-aice-lab/BLIP-MathThen you can get the generated text and classification score simultaneously.
README.md+3-3