uf-aice-lab commited on
Commit
cd0e2ac
·
verified ·
1 Parent(s): 9d48378

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +3 -3
README.md CHANGED
@@ -27,7 +27,7 @@ class BLIPNet(torch.nn.Module):
27
  nn.Linear(self.ebd_dim, fc_dim),
28
  nn.ReLU(),
29
  )
30
- self.score = nn.Linear(fc_dim, 5) # 5 classes
31
 
32
  def forward(self, pixel_values, input_ids):
33
  outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)
@@ -35,13 +35,13 @@ class BLIPNet(torch.nn.Module):
35
  image_text_embeds = self.head(image_text_embeds.view(-1, self.ebd_dim))
36
 
37
  # A classification model is based on embeddings from a generative model to leverage BLIP's powerful image-text encoding capabilities.
38
- logits = self.score(image_text_embeds)
39
 
40
  # generated text, probabilities of classification
41
  return outputs, logits
42
 
43
  model = BLIPNet()
44
  model.load_state_dict(torch.load("BLILP_Generation_Classification.bin"), strict=False)
45
-
46
  You need to input the sample in the same way as shown in the example provided at: https://huggingface.co/uf-aice-lab/BLIP-Math
47
  Then you can get the generated text and classification score simultaneously.
 
27
  nn.Linear(self.ebd_dim, fc_dim),
28
  nn.ReLU(),
29
  )
30
+ self.output1= nn.Linear(fc_dim, 5) # 5 classes
31
 
32
  def forward(self, pixel_values, input_ids):
33
  outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)
 
35
  image_text_embeds = self.head(image_text_embeds.view(-1, self.ebd_dim))
36
 
37
  # A classification model is based on embeddings from a generative model to leverage BLIP's powerful image-text encoding capabilities.
38
+ logits = self.output1(image_text_embeds)
39
 
40
  # generated text, probabilities of classification
41
  return outputs, logits
42
 
43
  model = BLIPNet()
44
  model.load_state_dict(torch.load("BLILP_Generation_Classification.bin"), strict=False)
45
+ ```python
46
  You need to input the sample in the same way as shown in the example provided at: https://huggingface.co/uf-aice-lab/BLIP-Math
47
  Then you can get the generated text and classification score simultaneously.