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

Commit

Permalink
_load_data as a generator (#4253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mojtaba-komeili committed Dec 15, 2021
1 parent ce83b61 commit d00f7d3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions parlai/tasks/wizard_of_internet/agents.py
Expand Up @@ -183,11 +183,9 @@ def add_cmdline_args(cls, parser: ParlaiParser, partial_opt=None) -> ParlaiParse

def _load_data(self, datafile):
logging.info(f'Loading data from {datafile} ...')
dialogs = []
with jsonlines.open(datafile, 'r') as fin:
for dialog_json in tqdm(fin):
dialogs.append(self._get_episode_examples(dialog_json))
return dialogs
yield self._get_episode_examples(dialog_json)

def _get_episode_examples(self, dialog_json):
data = get_single_val_from_dict(dialog_json)
Expand Down

0 comments on commit d00f7d3

Please sign in to comment.