Update README.md
Browse files26 unmodified lines27282930303132331 unmodified line35363738383940414243444545464726 unmodified lines nn.Linear(self.ebd_dim, fc_dim), nn.ReLU(), ) self.score = nn.Linear(fc_dim, 5) # 5 classes self.output1= nn.Linear(fc_dim, 5) # 5 classes def forward(self, pixel_values, input_ids): outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)1 unmodified line image_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) logits = self.output1(image_text_embeds)
# generated text, probabilities of classification return outputs, logits model = 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