Spaces:
Sleeping
Sleeping
Vasudevakrishna
commited on
Commit
•
0c10fb3
1
Parent(s):
c5fb1de
Update app.py
Browse files
app.py
CHANGED
@@ -84,6 +84,10 @@ def generate_answers(img=None, aud = None, q = None, max_tokens = 30):
|
|
84 |
print(predicted_caption)
|
85 |
next_token_embeds = phi2_model.model.embed_tokens(predicted_word_token)
|
86 |
combined_embeds = torch.cat([combined_embeds, next_token_embeds], dim=1)
|
|
|
|
|
|
|
|
|
87 |
predicted_captions_decoded = tokenizer.batch_decode(predicted_caption,ignore_index = 50256)[0]
|
88 |
predicted_captions_decoded = predicted_captions_decoded.replace("<|endoftext|>","")
|
89 |
return predicted_captions_decoded
|
|
|
84 |
print(predicted_caption)
|
85 |
next_token_embeds = phi2_model.model.embed_tokens(predicted_word_token)
|
86 |
combined_embeds = torch.cat([combined_embeds, next_token_embeds], dim=1)
|
87 |
+
del next_token_embeds
|
88 |
+
del predicted_word_token
|
89 |
+
del predicted_word_token_logits
|
90 |
+
del combined_embeds
|
91 |
predicted_captions_decoded = tokenizer.batch_decode(predicted_caption,ignore_index = 50256)[0]
|
92 |
predicted_captions_decoded = predicted_captions_decoded.replace("<|endoftext|>","")
|
93 |
return predicted_captions_decoded
|