Update app.py
Browse files
app.py
CHANGED
@@ -104,7 +104,7 @@ def imageMode(image, question):
|
|
104 |
imgToTextEmb = img_proj_head(image_embedding)
|
105 |
print('-------text embedding from projection obtained-----------')
|
106 |
question = "Question: " + question + "Answer: "
|
107 |
-
Qtokens = torch.tensor(tokenizer_text.encode(question, add_special_tokens=True))
|
108 |
Qtoken_embeddings = phi2_finetuned.get_submodule('model.embed_tokens')(Qtokens)
|
109 |
print('-------question embedding from phi2 obtained-----------')
|
110 |
inputs = torch.concat((imgToTextEmb, Qtoken_embeddings), axis=-2)
|
|
|
104 |
imgToTextEmb = img_proj_head(image_embedding)
|
105 |
print('-------text embedding from projection obtained-----------')
|
106 |
question = "Question: " + question + "Answer: "
|
107 |
+
Qtokens = torch.tensor(tokenizer_text.encode(question, add_special_tokens=True)).unsqueeze(0)
|
108 |
Qtoken_embeddings = phi2_finetuned.get_submodule('model.embed_tokens')(Qtokens)
|
109 |
print('-------question embedding from phi2 obtained-----------')
|
110 |
inputs = torch.concat((imgToTextEmb, Qtoken_embeddings), axis=-2)
|