Update README.md
Browse files
README.md
CHANGED
|
@@ -4,14 +4,14 @@ license: mit
|
|
| 4 |
|
| 5 |
This is the structure of the BLIPNet model. You can load the model with it, or you can create a bigger model for your task.
|
| 6 |
|
| 7 |
-
class BLIPNet(torch.nn.Module):
|
| 8 |
def __init__(self, ):
|
| 9 |
super().__init__()
|
| 10 |
#Generation Model
|
| 11 |
self.model = BlipForConditionalGeneration.from_pretrained(MODEL_NAME, cache_dir="model")
|
| 12 |
#Same with https://huggingface.co/uf-aice-lab/BLIP-Math
|
| 13 |
self.ebd_dim = ebd_dim= 443136
|
| 14 |
-
|
| 15 |
#Classification Model
|
| 16 |
fc_dim = 64 # You can choose a higher number for better performance, for example, 1024.
|
| 17 |
self.head = nn.Sequential(
|
|
@@ -19,8 +19,7 @@ class BLIPNet(torch.nn.Module):
|
|
| 19 |
nn.ReLU(),
|
| 20 |
)
|
| 21 |
self.score = nn.Linear(fc_dim, 5) #5 classes
|
| 22 |
-
|
| 23 |
-
|
| 24 |
def forward(self, pixel_values, input_ids):
|
| 25 |
outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)
|
| 26 |
image_text_embeds = self.model.vision_model(pixel_values, return_dict=True).last_hidden_state
|
|
|
|
| 4 |
|
| 5 |
This is the structure of the BLIPNet model. You can load the model with it, or you can create a bigger model for your task.
|
| 6 |
|
| 7 |
+
class BLIPNet(torch.nn.Module):
|
| 8 |
def __init__(self, ):
|
| 9 |
super().__init__()
|
| 10 |
#Generation Model
|
| 11 |
self.model = BlipForConditionalGeneration.from_pretrained(MODEL_NAME, cache_dir="model")
|
| 12 |
#Same with https://huggingface.co/uf-aice-lab/BLIP-Math
|
| 13 |
self.ebd_dim = ebd_dim= 443136
|
| 14 |
+
|
| 15 |
#Classification Model
|
| 16 |
fc_dim = 64 # You can choose a higher number for better performance, for example, 1024.
|
| 17 |
self.head = nn.Sequential(
|
|
|
|
| 19 |
nn.ReLU(),
|
| 20 |
)
|
| 21 |
self.score = nn.Linear(fc_dim, 5) #5 classes
|
| 22 |
+
|
|
|
|
| 23 |
def forward(self, pixel_values, input_ids):
|
| 24 |
outputs = self.model(input_ids=input_ids, pixel_values=pixel_values, labels=input_ids)
|
| 25 |
image_text_embeds = self.model.vision_model(pixel_values, return_dict=True).last_hidden_state
|