Skip to content

Commit

Permalink
Personality Captions interactive mode fix (facebookresearch#2963)
Browse files Browse the repository at this point in the history
* Add fix

* Fixes
  • Loading branch information
EricMichaelSmith authored Aug 12, 2020
1 parent 25f66a7 commit 2345a05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions projects/personality_captions/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ def setup_interactive():
)
opt['task'] = 'parlai.agents.local_human.local_human:LocalHumanAgent'
opt['image_mode'] = 'resnet152'
opt['no_cuda'] = True
opt['override']['no_cuda'] = True
SHARED['opt'] = opt
SHARED['image_loader'] = ImageLoader(opt)

Expand Down
4 changes: 2 additions & 2 deletions projects/personality_captions/transresnet/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,9 @@ def choose_best_caption(
for img_index in range(len(context_encoded)):
context_encoding = context_encoded[img_index : img_index + 1, :]
scores = torch.mm(
candidates_encoded[img_index]
candidates_encoded[img_index].to(context_encoding)
if not one_cand_set
else candidates_encoded,
else candidates_encoded.to(context_encoding),
context_encoding.transpose(0, 1),
)
if k >= 1:
Expand Down

0 comments on commit 2345a05

Please sign in to comment.