holylovenia
commited on
Upload indolem_ntp.py with huggingface_hub
Browse files- indolem_ntp.py +12 -12
indolem_ntp.py
CHANGED
@@ -3,10 +3,10 @@ from typing import Dict, List, Tuple
|
|
3 |
|
4 |
import json
|
5 |
import datasets
|
6 |
-
from
|
7 |
|
8 |
-
from
|
9 |
-
from
|
10 |
|
11 |
_CITATION = """\
|
12 |
@article{DBLP:journals/corr/abs-2011-00677,
|
@@ -57,28 +57,28 @@ _URLS = {
|
|
57 |
_SUPPORTED_TASKS = [Tasks.NEXT_SENTENCE_PREDICTION]
|
58 |
|
59 |
_SOURCE_VERSION = "1.0.0"
|
60 |
-
|
61 |
|
62 |
|
63 |
class IndolemNTPDataset(datasets.GeneratorBasedBuilder):
|
64 |
"""NTP (Next Tweet prediction) is based on next sentence prediction (NSP), consists of a Twitter thread (containing 2 to 4 tweets) and four possible options for the next tweet, one of which is the actual response from the original thread."""
|
65 |
|
66 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
67 |
-
|
68 |
|
69 |
BUILDER_CONFIGS = [
|
70 |
-
|
71 |
name="indolem_ntp_source",
|
72 |
version=SOURCE_VERSION,
|
73 |
description="Indolem NTP source schema",
|
74 |
schema="source",
|
75 |
subset_id="indolem_ntp",
|
76 |
),
|
77 |
-
|
78 |
-
name="
|
79 |
-
version=
|
80 |
description="Indolem NTP Nusantara schema",
|
81 |
-
schema="
|
82 |
subset_id="indolem_ntp",
|
83 |
),
|
84 |
]
|
@@ -95,7 +95,7 @@ class IndolemNTPDataset(datasets.GeneratorBasedBuilder):
|
|
95 |
"label": datasets.Value("int8"),
|
96 |
}
|
97 |
)
|
98 |
-
elif self.config.schema == "
|
99 |
features = schemas.pairs_features([0, 1])
|
100 |
|
101 |
return datasets.DatasetInfo(
|
@@ -146,7 +146,7 @@ class IndolemNTPDataset(datasets.GeneratorBasedBuilder):
|
|
146 |
}
|
147 |
yield i, ex
|
148 |
|
149 |
-
elif self.config.schema == "
|
150 |
for i, row in enumerate(data):
|
151 |
ex = {
|
152 |
"id": str(i),
|
|
|
3 |
|
4 |
import json
|
5 |
import datasets
|
6 |
+
from seacrowd.utils import schemas
|
7 |
|
8 |
+
from seacrowd.utils.configs import SEACrowdConfig
|
9 |
+
from seacrowd.utils.constants import Tasks
|
10 |
|
11 |
_CITATION = """\
|
12 |
@article{DBLP:journals/corr/abs-2011-00677,
|
|
|
57 |
_SUPPORTED_TASKS = [Tasks.NEXT_SENTENCE_PREDICTION]
|
58 |
|
59 |
_SOURCE_VERSION = "1.0.0"
|
60 |
+
_SEACROWD_VERSION = "2024.06.20"
|
61 |
|
62 |
|
63 |
class IndolemNTPDataset(datasets.GeneratorBasedBuilder):
|
64 |
"""NTP (Next Tweet prediction) is based on next sentence prediction (NSP), consists of a Twitter thread (containing 2 to 4 tweets) and four possible options for the next tweet, one of which is the actual response from the original thread."""
|
65 |
|
66 |
SOURCE_VERSION = datasets.Version(_SOURCE_VERSION)
|
67 |
+
SEACROWD_VERSION = datasets.Version(_SEACROWD_VERSION)
|
68 |
|
69 |
BUILDER_CONFIGS = [
|
70 |
+
SEACrowdConfig(
|
71 |
name="indolem_ntp_source",
|
72 |
version=SOURCE_VERSION,
|
73 |
description="Indolem NTP source schema",
|
74 |
schema="source",
|
75 |
subset_id="indolem_ntp",
|
76 |
),
|
77 |
+
SEACrowdConfig(
|
78 |
+
name="indolem_ntp_seacrowd_pairs",
|
79 |
+
version=SEACROWD_VERSION,
|
80 |
description="Indolem NTP Nusantara schema",
|
81 |
+
schema="seacrowd_pairs",
|
82 |
subset_id="indolem_ntp",
|
83 |
),
|
84 |
]
|
|
|
95 |
"label": datasets.Value("int8"),
|
96 |
}
|
97 |
)
|
98 |
+
elif self.config.schema == "seacrowd_pairs":
|
99 |
features = schemas.pairs_features([0, 1])
|
100 |
|
101 |
return datasets.DatasetInfo(
|
|
|
146 |
}
|
147 |
yield i, ex
|
148 |
|
149 |
+
elif self.config.schema == "seacrowd_pairs":
|
150 |
for i, row in enumerate(data):
|
151 |
ex = {
|
152 |
"id": str(i),
|