nurik040404 commited on
Commit
1cd73a5
·
1 Parent(s): b30b958

Update mse.py

Browse files
Files changed (1) hide show
  1. mse.py +7 -4
mse.py CHANGED
@@ -111,7 +111,10 @@ class StackExchange(datasets.GeneratorBasedBuilder):
111
 
112
  with open(filepath, encoding="utf-8") as f:
113
  dctx = zstandard.ZstdDecompressor()
114
- data = dctx.decompress(f)
115
- for id_, row in enumerate(data):
116
- data = json.loads(row)
117
- yield id_, data
 
 
 
 
111
 
112
  with open(filepath, encoding="utf-8") as f:
113
  dctx = zstandard.ZstdDecompressor()
114
+ i = 0
115
+ with dctx.stream_reader(f) as st:
116
+ with io.TextIOWrapper(st) as text_st:
117
+ while (line:=text_st.readline()) != '':
118
+ data = json.loads(line)
119
+ yield i, data
120
+ i += 1