system HF staff commited on
Commit
199d992
1 Parent(s): 498aa8a

Update files from the datasets library (from 1.5.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.5.0

Files changed (1) hide show
  1. wikipedia.py +2 -5
wikipedia.py CHANGED
@@ -473,10 +473,7 @@ class Wikipedia(datasets.BeamBasedBuilder):
473
  else:
474
  utf_f = f
475
 
476
- # To clear root, to free-up more memory than just `elem.clear()`.
477
  context = etree.iterparse(utf_f, events=("end",))
478
- context = iter(context)
479
- unused_event, root = next(context)
480
  for unused_event, elem in context:
481
  if not elem.tag.endswith("page"):
482
  continue
@@ -487,11 +484,11 @@ class Wikipedia(datasets.BeamBasedBuilder):
487
 
488
  # Filter pages that are not in the "main" namespace.
489
  if ns != "0":
490
- root.clear()
491
  continue
492
 
493
  raw_content = elem.find("./{0}revision/{0}text".format(namespace)).text
494
- root.clear()
495
 
496
  # Filter redirects.
497
  if raw_content is None or raw_content.lower().startswith("#redirect"):
 
473
  else:
474
  utf_f = f
475
 
 
476
  context = etree.iterparse(utf_f, events=("end",))
 
 
477
  for unused_event, elem in context:
478
  if not elem.tag.endswith("page"):
479
  continue
 
484
 
485
  # Filter pages that are not in the "main" namespace.
486
  if ns != "0":
487
+ elem.clear()
488
  continue
489
 
490
  raw_content = elem.find("./{0}revision/{0}text".format(namespace)).text
491
+ elem.clear()
492
 
493
  # Filter redirects.
494
  if raw_content is None or raw_content.lower().startswith("#redirect"):