Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
[Bug] Several misc. fixes (#4459)
Browse files Browse the repository at this point in the history
* fix

* upgrade opt instead

* remove stray line
  • Loading branch information
klshuster authored Mar 29, 2022
1 parent 808e267 commit 1028312
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion parlai/core/image_featurizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _init_transform(self):

self.transform = self.transforms.Compose(
[
self.transforms.Scale(self.image_size),
self.transforms.Resize(self.image_size),
self.transforms.CenterCrop(self.crop_size),
self.transforms.ToTensor(),
self.transforms.Normalize(
Expand Down
4 changes: 4 additions & 0 deletions parlai/core/torch_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,10 @@ def upgrade_opt(cls, opt_from_disk: Opt):
# model it MUST add the fp16 tokens, even if it's not fp16 mode now.
opt_from_disk['force_fp16_tokens'] = True

if opt_from_disk.get('image_mode') == 'none':
# 2022-03-28 this mode changed to 'no_image_model' a long time ago.
opt_from_disk['image_mode'] = 'no_image_model'

return opt_from_disk

def reset(self):
Expand Down
2 changes: 1 addition & 1 deletion parlai/scripts/interactive_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def interactive_web(opt):
agent.opt.log()
SHARED['opt'] = agent.opt
SHARED['agent'] = agent
SHARED['world'] = create_task(SHARED.get('opt'), [human_agent, SHARED['agent']])
SHARED['world'] = create_task(opt, [human_agent, SHARED['agent']])

MyHandler.protocol_version = 'HTTP/1.0'
httpd = HTTPServer((opt['host'], opt['port']), MyHandler)
Expand Down

0 comments on commit 1028312

Please sign in to comment.