albertvillanova HF staff commited on
Commit
e3be5f3
1 Parent(s): e0c9133

Support streaming compguesswhat dataset (#4968)

Browse files

Commit from https://github.com/huggingface/datasets/commit/37361fe06e5ab992de2f9674aed5ea13498ec351

Files changed (1) hide show
  1. compguesswhat.py +4 -3
compguesswhat.py CHANGED
@@ -248,6 +248,7 @@ class Compguesswhat(datasets.GeneratorBasedBuilder):
248
  return game["id"], game
249
 
250
  """Yields examples."""
251
- with gzip.open(filepath) as in_file:
252
- for data in in_file:
253
- yield _extract_game_tuple(data)
 
 
248
  return game["id"], game
249
 
250
  """Yields examples."""
251
+ with open(filepath, "rb") as gzip_file:
252
+ with gzip.open(gzip_file) as in_file:
253
+ for data in in_file:
254
+ yield _extract_game_tuple(data)