fix(weibo.py): fix online dataviewer error
Browse files
weibo.py
CHANGED
@@ -106,13 +106,15 @@ class WeiboNamedEntities(datasets.GeneratorBasedBuilder):
|
|
106 |
]
|
107 |
|
108 |
def _generate_examples(self, filepath):
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
116 |
|
117 |
|
118 |
|
|
|
106 |
]
|
107 |
|
108 |
def _generate_examples(self, filepath):
|
109 |
+
# fix: https://discuss.huggingface.co/t/dataset-preview-error-with-a-dataset-script-and-parquet-files/43160
|
110 |
+
with open(filepath, "rb") as f:
|
111 |
+
with pq.ParquetFile(f) as file:
|
112 |
+
_id = -1
|
113 |
+
for i in file.iter_batches(batch_size=64):
|
114 |
+
rows = i.to_pylist()
|
115 |
+
for row in rows:
|
116 |
+
_id+=1
|
117 |
+
yield _id, row
|
118 |
|
119 |
|
120 |
|