Datasets:

Modalities:
Text
ArXiv:
Libraries:
Datasets
Maurice Weber commited on
Commit
a6472f5
1 Parent(s): 968c26b

remove _sample

Browse files
Files changed (1) hide show
  1. RedPajama-Data-V2.py +19 -21
RedPajama-Data-V2.py CHANGED
@@ -140,21 +140,14 @@ class RedPajamaV2(datasets.GeneratorBasedBuilder):
140
 
141
  BUILDER_CONFIGS = [
142
  RedPajamaDataV2Config(
143
- name='_sample',
144
  version=datasets.Version("1.0.0", ""),
145
- description=f"RedPajamaV2 Sample",
146
  ),
147
- # this one is just an alias for the sample
148
  RedPajamaDataV2Config(
149
  name='sample',
150
  version=datasets.Version("1.0.0", ""),
151
  description=f"RedPajamaV2 Sample",
152
- ),
153
-
154
- RedPajamaDataV2Config(
155
- name='default',
156
- version=datasets.Version("1.0.0", ""),
157
- description=f"RedPajamaV2",
158
  )
159
  ]
160
 
@@ -327,18 +320,23 @@ class RedPajamaV2(datasets.GeneratorBasedBuilder):
327
  for doc_file, qs_file, listings_id in zip(
328
  docs_files, qs_files, listings_ids
329
  ):
330
- with gzip.open(doc_file, "rt", encoding="utf-8") as df:
331
- with gzip.open(qs_file, "rt", encoding="utf-8") as qf:
332
- for row, (doc, qs) in enumerate(zip(df, qf)):
333
- doc_id = f"{listings_id}.json.gz/{row}"
334
- try:
335
- yield self.handle_record(part, doc_id, doc, qs)
336
- except Exception as e:
337
- print(f'doc_file: {doc_file}')
338
- print(f'qs_file: {qs_file}')
339
- print(f'row: {row}')
340
- traceback.print_exc()
341
- raise e
 
 
 
 
 
342
 
343
  @staticmethod
344
  def handle_record(part, doc_id, doc, qs):
 
140
 
141
  BUILDER_CONFIGS = [
142
  RedPajamaDataV2Config(
143
+ name='default',
144
  version=datasets.Version("1.0.0", ""),
145
+ description=f"RedPajamaV2",
146
  ),
 
147
  RedPajamaDataV2Config(
148
  name='sample',
149
  version=datasets.Version("1.0.0", ""),
150
  description=f"RedPajamaV2 Sample",
 
 
 
 
 
 
151
  )
152
  ]
153
 
 
320
  for doc_file, qs_file, listings_id in zip(
321
  docs_files, qs_files, listings_ids
322
  ):
323
+ try:
324
+ with gzip.open(doc_file, "rt", encoding="utf-8") as df:
325
+ with gzip.open(qs_file, "rt", encoding="utf-8") as qf:
326
+ for row, (doc, qs) in enumerate(zip(df, qf)):
327
+ doc_id = f"{listings_id}.json.gz/{row}"
328
+ try:
329
+ yield self.handle_record(part, doc_id, doc, qs)
330
+ except Exception as e:
331
+ print(f'failed handling row {row} in '
332
+ f'{doc_file} ({qs_file})')
333
+ traceback.print_exc()
334
+ continue
335
+ except gzip.BadGzipFile as e:
336
+ # skip broken gzip files
337
+ print(f'BadGzipFile: {doc_file, qs_file}')
338
+ traceback.print_exc()
339
+ continue
340
 
341
  @staticmethod
342
  def handle_record(part, doc_id, doc, qs):