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

Commit

Permalink
Make CCPE work (#3487)
Browse files Browse the repository at this point in the history
Cause it's been a while and Google apparently moved the directory and mildly changed the format of the JSON blob.
  • Loading branch information
moyapchen authored Mar 9, 2021
1 parent 35e468a commit 503409f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions parlai/tasks/ccpe/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,11 @@ def _setup_data(self):
fpath = os.path.join(self.opt['datapath'], 'CCPE', 'ccpe.json')

with PathManager.open(fpath, 'r') as infile:
data = infile.read()
new_data = data.replace('}\n{', '},{')
json_data = json.loads(f'[{new_data}]')
json_data = json.load(infile)

flattenedData = []

for ep in range(len(json_data)):
currEp = []

entry = {}
currSegments = []
for i, utterance in enumerate(json_data[ep]['utterances']):
Expand Down
4 changes: 2 additions & 2 deletions parlai/tasks/ccpe/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

RESOURCES = [
DownloadableFile(
'https://storage.googleapis.com/dialog-data-corpus/CCPE-M-2019/data.json',
'https://raw.githubusercontent.com/google-research-datasets/ccpe/main/data.json',
'ccpe.json',
'4ff051ea7ea60cf0f480c911c7e2cfed56434e2e2c9ea8965ac5e26365773f0a',
zipped=False,
Expand All @@ -20,7 +20,7 @@

def build(opt):
dpath = os.path.join(opt['datapath'], 'CCPE')
version = '1.0'
version = '1.1'

if not build_data.built(dpath, version_string=version):
print('[building data: ' + dpath + ']')
Expand Down

0 comments on commit 503409f

Please sign in to comment.