Skip to content

Commit

Permalink
Merge pull request #47 from jmisilo/46-temp-check
Browse files Browse the repository at this point in the history
46 - Temperature checking
  • Loading branch information
jmisilo authored Oct 30, 2022
2 parents b8ec13b + a91f62a commit fb893a0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ def forward(self, img, temperature=1.0):
caption: generated caption [str]
tokens: generated tokens [torch.Tensor]
'''
# only one image at a time

if temperature <= 0.0:
temperature = 1.0
print('Temperature must be positive. Setting it to 1.0')

with torch.no_grad():
img_embedded = self.ie(img)
Expand Down

0 comments on commit fb893a0

Please sign in to comment.