disable progress bar in filtering and lower batch size to avoid segmentation fault
Browse files
economy-watchers-survey-evaluation.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import datasets
|
2 |
from datasets import load_dataset
|
3 |
-
from datasets.utils.logging import disable_progress_bar
|
4 |
|
5 |
# TODO: Add BibTeX citation
|
6 |
# Find for instance the citation on arxiv or on the dataset repo/website
|
@@ -14,11 +13,11 @@ Dataset from the Economy Watchers Survey for use as evaluation tasks
|
|
14 |
|
15 |
_HOMEPAGE = "https://github.com/retarfi/economy-watchers-survey"
|
16 |
_LICENSE = "CC-BY 4.0"
|
17 |
-
VERSION = datasets.Version("0.1.
|
18 |
EWS_REPO_NAME = "retarfi/economy-watchers-survey"
|
19 |
|
20 |
LABEL_REASON_OTHER: str = "それ以外"
|
21 |
-
|
22 |
|
23 |
|
24 |
class EconomyWatchersSurveyConfig(datasets.BuilderConfig):
|
@@ -104,7 +103,7 @@ class EconomyWatchersSurveyDataset(datasets.GeneratorBasedBuilder):
|
|
104 |
]
|
105 |
|
106 |
def _generate_examples(self, split: str):
|
107 |
-
batch_size =
|
108 |
|
109 |
ds_info_current = load_dataset(
|
110 |
EWS_REPO_NAME, "current", revision=self.config.ews_version, split=split
|
@@ -119,7 +118,11 @@ class EconomyWatchersSurveyDataset(datasets.GeneratorBasedBuilder):
|
|
119 |
split=f"{split}[{start_idx}:{end_idx}]"
|
120 |
)
|
121 |
|
|
|
|
|
122 |
ds_current_batch = ds_current_batch.filter(lambda example: example["判断の理由"] is not None)
|
|
|
|
|
123 |
for example in ds_current_batch:
|
124 |
str_label = example["判断の理由"]
|
125 |
if str_label not in self.info.features["label"].names:
|
|
|
1 |
import datasets
|
2 |
from datasets import load_dataset
|
|
|
3 |
|
4 |
# TODO: Add BibTeX citation
|
5 |
# Find for instance the citation on arxiv or on the dataset repo/website
|
|
|
13 |
|
14 |
_HOMEPAGE = "https://github.com/retarfi/economy-watchers-survey"
|
15 |
_LICENSE = "CC-BY 4.0"
|
16 |
+
VERSION = datasets.Version("0.1.2")
|
17 |
EWS_REPO_NAME = "retarfi/economy-watchers-survey"
|
18 |
|
19 |
LABEL_REASON_OTHER: str = "それ以外"
|
20 |
+
DISABLED_BARS: bool = datasets.are_progress_bars_disabled()
|
21 |
|
22 |
|
23 |
class EconomyWatchersSurveyConfig(datasets.BuilderConfig):
|
|
|
103 |
]
|
104 |
|
105 |
def _generate_examples(self, split: str):
|
106 |
+
batch_size = 1000
|
107 |
|
108 |
ds_info_current = load_dataset(
|
109 |
EWS_REPO_NAME, "current", revision=self.config.ews_version, split=split
|
|
|
118 |
split=f"{split}[{start_idx}:{end_idx}]"
|
119 |
)
|
120 |
|
121 |
+
if not DISABLED_BARS:
|
122 |
+
datasets.disable_progress_bars()
|
123 |
ds_current_batch = ds_current_batch.filter(lambda example: example["判断の理由"] is not None)
|
124 |
+
if not DISABLED_BARS:
|
125 |
+
datasets.enable_progress_bars()
|
126 |
for example in ds_current_batch:
|
127 |
str_label = example["判断の理由"]
|
128 |
if str_label not in self.info.features["label"].names:
|