Update SimCLUE.py
Browse files- SimCLUE.py +9 -2
SimCLUE.py
CHANGED
|
@@ -40,6 +40,13 @@ class SimCLUE(datasets.GeneratorBasedBuilder):
|
|
| 40 |
'dev': 'dev.json',
|
| 41 |
'test_public': 'test_public.json'}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
BUILDER_CONFIGS = [
|
| 44 |
SimCLUEConfig(
|
| 45 |
name="train_rank",
|
|
@@ -112,7 +119,7 @@ class SimCLUE(datasets.GeneratorBasedBuilder):
|
|
| 112 |
def _split_generators(self, dl_manager):
|
| 113 |
dl_dir = dl_manager.download_and_extract(self.config.data_url)
|
| 114 |
return [datasets.SplitGenerator(
|
| 115 |
-
name=self.config.name,
|
| 116 |
gen_kwargs={
|
| 117 |
"filepath": os.path.join(dl_dir, self.part_file[self.config.name]),
|
| 118 |
})]
|
|
@@ -121,4 +128,4 @@ class SimCLUE(datasets.GeneratorBasedBuilder):
|
|
| 121 |
"""This function returns the examples in the raw (text) form."""
|
| 122 |
with open(filepath, 'r', encoding="utf-8") as f:
|
| 123 |
for idx, row in enumerate(f):
|
| 124 |
-
yield idx, json.loads(row)
|
|
|
|
| 40 |
'dev': 'dev.json',
|
| 41 |
'test_public': 'test_public.json'}
|
| 42 |
|
| 43 |
+
part_split = {'train_rank': datasets.Split.TRAIN,
|
| 44 |
+
'train_pair': datasets.Split.TRAIN,
|
| 45 |
+
'corpus': datasets.Split.TRAIN,
|
| 46 |
+
'train_pair_postive': datasets.Split.TRAIN,
|
| 47 |
+
'dev': datasets.Split.VALIDATION,
|
| 48 |
+
'test_public': datasets.Split.TEST}
|
| 49 |
+
|
| 50 |
BUILDER_CONFIGS = [
|
| 51 |
SimCLUEConfig(
|
| 52 |
name="train_rank",
|
|
|
|
| 119 |
def _split_generators(self, dl_manager):
|
| 120 |
dl_dir = dl_manager.download_and_extract(self.config.data_url)
|
| 121 |
return [datasets.SplitGenerator(
|
| 122 |
+
name=self.part_split[self.config.name],
|
| 123 |
gen_kwargs={
|
| 124 |
"filepath": os.path.join(dl_dir, self.part_file[self.config.name]),
|
| 125 |
})]
|
|
|
|
| 128 |
"""This function returns the examples in the raw (text) form."""
|
| 129 |
with open(filepath, 'r', encoding="utf-8") as f:
|
| 130 |
for idx, row in enumerate(f):
|
| 131 |
+
yield idx, json.loads(row)
|