init
Browse files
link_prediction_nell_one.py → fewshot_link_prediction.py
RENAMED
|
@@ -3,8 +3,8 @@ import datasets
|
|
| 3 |
|
| 4 |
|
| 5 |
logger = datasets.logging.get_logger(__name__)
|
| 6 |
-
_DESCRIPTION = """
|
| 7 |
-
_NAME = "
|
| 8 |
_VERSION = "0.0.0"
|
| 9 |
_CITATION = """
|
| 10 |
@inproceedings{xiong-etal-2018-one,
|
|
@@ -28,14 +28,15 @@ _CITATION = """
|
|
| 28 |
|
| 29 |
_HOME_PAGE = "https://github.com/asahi417/relbert"
|
| 30 |
_URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
str(datasets.Split.
|
| 34 |
-
str(datasets.Split.
|
| 35 |
-
}
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
-
class
|
| 39 |
"""BuilderConfig"""
|
| 40 |
|
| 41 |
def __init__(self, **kwargs):
|
|
@@ -43,18 +44,19 @@ class LinkPredictionConfig(datasets.BuilderConfig):
|
|
| 43 |
Args:
|
| 44 |
**kwargs: keyword arguments forwarded to super.
|
| 45 |
"""
|
| 46 |
-
super(
|
| 47 |
|
| 48 |
|
| 49 |
-
class
|
| 50 |
"""Dataset."""
|
| 51 |
|
| 52 |
BUILDER_CONFIGS = [
|
| 53 |
-
|
|
|
|
| 54 |
]
|
| 55 |
|
| 56 |
def _split_generators(self, dl_manager):
|
| 57 |
-
downloaded_file = dl_manager.download_and_extract(_URLS)
|
| 58 |
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
|
| 59 |
for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
|
| 60 |
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
logger = datasets.logging.get_logger(__name__)
|
| 6 |
+
_DESCRIPTION = """Few shots link prediction dataset. """
|
| 7 |
+
_NAME = "fewshot_link_prediction"
|
| 8 |
_VERSION = "0.0.0"
|
| 9 |
_CITATION = """
|
| 10 |
@inproceedings{xiong-etal-2018-one,
|
|
|
|
| 28 |
|
| 29 |
_HOME_PAGE = "https://github.com/asahi417/relbert"
|
| 30 |
_URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
|
| 31 |
+
_TYPES = ["nell", "wiki"]
|
| 32 |
+
_URLS = {i: {
|
| 33 |
+
str(datasets.Split.TRAIN): [f'{_URL}/{i}.train.jsonl'],
|
| 34 |
+
str(datasets.Split.VALIDATION): [f'{_URL}/{i}.valid.jsonl'],
|
| 35 |
+
str(datasets.Split.TEST): [f'{_URL}/{i}.test.jsonl']
|
| 36 |
+
} for i in _TYPES}
|
| 37 |
|
| 38 |
|
| 39 |
+
class FewShotLinkPredictionConfig(datasets.BuilderConfig):
|
| 40 |
"""BuilderConfig"""
|
| 41 |
|
| 42 |
def __init__(self, **kwargs):
|
|
|
|
| 44 |
Args:
|
| 45 |
**kwargs: keyword arguments forwarded to super.
|
| 46 |
"""
|
| 47 |
+
super(FewShotLinkPredictionConfig, self).__init__(**kwargs)
|
| 48 |
|
| 49 |
|
| 50 |
+
class FewShotLinkPrediction(datasets.GeneratorBasedBuilder):
|
| 51 |
"""Dataset."""
|
| 52 |
|
| 53 |
BUILDER_CONFIGS = [
|
| 54 |
+
FewShotLinkPredictionConfig(name=i, version=datasets.Version(_VERSION), description=_DESCRIPTION)
|
| 55 |
+
for i in sorted(_TYPES)
|
| 56 |
]
|
| 57 |
|
| 58 |
def _split_generators(self, dl_manager):
|
| 59 |
+
downloaded_file = dl_manager.download_and_extract(_URLS[self.config.name])
|
| 60 |
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
|
| 61 |
for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
|
| 62 |
|