try using manual dir
Browse files- SNLI-VE.py +7 -6
SNLI-VE.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
import json
|
| 5 |
import os
|
| 6 |
import datasets
|
|
|
|
| 7 |
|
| 8 |
_CITATION = """\
|
| 9 |
@article{xie2019visual,
|
|
@@ -59,7 +60,6 @@ _SNLI_VE_SPLITS = {
|
|
| 59 |
"validation": "snli_ve_dev.jsonl",
|
| 60 |
"test": "snli_ve_test.jsonl",
|
| 61 |
}
|
| 62 |
-
JZ_FOLDER_PATH = f"{os.environ['cnw_ALL_CCFRSCRATCH']}/local_datasets/flickr30k-images.tar.gz"
|
| 63 |
|
| 64 |
_FEATURES = datasets.Features(
|
| 65 |
{
|
|
@@ -75,7 +75,7 @@ _FEATURES = datasets.Features(
|
|
| 75 |
class SNLIVE(datasets.GeneratorBasedBuilder):
|
| 76 |
"""SNLIVE."""
|
| 77 |
|
| 78 |
-
|
| 79 |
DEFAULT_CONFIG_NAME = "Default"
|
| 80 |
def _info(self):
|
| 81 |
return datasets.DatasetInfo(
|
|
@@ -87,6 +87,11 @@ class SNLIVE(datasets.GeneratorBasedBuilder):
|
|
| 87 |
)
|
| 88 |
|
| 89 |
def _split_generators(self, dl_manager):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
urls = {
|
| 91 |
"Default": {
|
| 92 |
"train": os.path.join(_SNLI_VE_URL_BASE, _SNLI_VE_SPLITS["train"]),
|
|
@@ -95,10 +100,6 @@ class SNLIVE(datasets.GeneratorBasedBuilder):
|
|
| 95 |
},
|
| 96 |
}
|
| 97 |
snli_ve_annotation_path = dl_manager.download_and_extract(urls)
|
| 98 |
-
images_path = os.path.join(
|
| 99 |
-
dl_manager.extract(JZ_FOLDER_PATH),
|
| 100 |
-
"flickr30k-images"
|
| 101 |
-
)
|
| 102 |
|
| 103 |
return [
|
| 104 |
datasets.SplitGenerator(
|
|
|
|
| 4 |
import json
|
| 5 |
import os
|
| 6 |
import datasets
|
| 7 |
+
from pathlib import Path
|
| 8 |
|
| 9 |
_CITATION = """\
|
| 10 |
@article{xie2019visual,
|
|
|
|
| 60 |
"validation": "snli_ve_dev.jsonl",
|
| 61 |
"test": "snli_ve_test.jsonl",
|
| 62 |
}
|
|
|
|
| 63 |
|
| 64 |
_FEATURES = datasets.Features(
|
| 65 |
{
|
|
|
|
| 75 |
class SNLIVE(datasets.GeneratorBasedBuilder):
|
| 76 |
"""SNLIVE."""
|
| 77 |
|
| 78 |
+
_LOCAL_IMAGE_FOLDER_NAME = "flickr30k-images"
|
| 79 |
DEFAULT_CONFIG_NAME = "Default"
|
| 80 |
def _info(self):
|
| 81 |
return datasets.DatasetInfo(
|
|
|
|
| 87 |
)
|
| 88 |
|
| 89 |
def _split_generators(self, dl_manager):
|
| 90 |
+
images_path = os.path.join(
|
| 91 |
+
dl_manager.extract(os.path.join(dl_manager.manual_dir, "flickr30k-images.tar.gz")),
|
| 92 |
+
self._LOCAL_IMAGE_FOLDER_NAME
|
| 93 |
+
)
|
| 94 |
+
|
| 95 |
urls = {
|
| 96 |
"Default": {
|
| 97 |
"train": os.path.join(_SNLI_VE_URL_BASE, _SNLI_VE_SPLITS["train"]),
|
|
|
|
| 100 |
},
|
| 101 |
}
|
| 102 |
snli_ve_annotation_path = dl_manager.download_and_extract(urls)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
return [
|
| 105 |
datasets.SplitGenerator(
|