Skip to content

Commit

Permalink
Refactor batch parley, prepare for MultiAgent Batch Parley (facebookr…
Browse files Browse the repository at this point in the history
…esearch#29)

* start

* batch cleanup, prepare for multiagent batch

* oops

* generalize display

* cleaning single vs. multi + comments

* cleaning single vs. multi + comments

* cleaning single vs. multi + comments

* small update

* small fixes

* Tasks (facebookresearch#30)

Task fixes, changes multiworld.display a tiny bit, added a few init.py's, and fixed a few docs.

* multiagent batch

* start

* batch cleanup, prepare for multiagent batch

* oops

* generalize display

* cleaning single vs. multi + comments

* cleaning single vs. multi + comments

* cleaning single vs. multi + comments

* small update

* small fixes

* multiagent batch

* small

* bug
  • Loading branch information
jaseweston authored May 3, 2017
1 parent a74590b commit 53b400e
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 210 deletions.
10 changes: 5 additions & 5 deletions parlai/core/fbdialog_teacher.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def __init__(self, opt, shared=None):

def label_candidates(self):
return self.cands

def load_cands(self, path):
"""Load global fixed set of candidate labels that the teacher provides every
example (the true labels for a specific example are also added to this set,
so that it's possible to get the right answer).
"""
"""Load global fixed set of candidate labels that the teacher provides every
example (the true labels for a specific example are also added to this set,
so that it's possible to get the right answer).
"""
if path is None:
return None
cands = []
Expand Down
12 changes: 10 additions & 2 deletions parlai/core/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
def str2bool(value):
return value.lower() in ('yes', 'true', 't', '1', 'y')

def path(s):
# Add a trailing slash if its not there.
if s[-1] != '/':
s += '/'
return s

class ParlaiParser(object):
"""Pseudo-extension of argparse which sets a number of parameters for the
Expand Down Expand Up @@ -96,10 +101,13 @@ def parse_args(self, args=None, print_args=True):
"""
self.args = self.parser.parse_args(args=args)
self.opt = {k: v for k, v in vars(self.args).items() if v is not None}
if print_args:
self.print_args()
if 'download_path' in self.opt:
self.opt['download_path'] = path(self.opt['download_path'])
os.environ['PARLAI_DOWNPATH'] = self.opt['download_path']
if 'datapath' in self.opt:
self.opt['datapath'] = path(self.opt['datapath'])
if print_args:
self.print_args()
return self.opt

def print_args(self):
Expand Down
Loading

0 comments on commit 53b400e

Please sign in to comment.