jbloom
commited on
Commit
·
21bb2fa
1
Parent(s):
b553e52
update filepath
Browse files- GBI-16-4D.py +4 -2
GBI-16-4D.py
CHANGED
@@ -23,6 +23,8 @@ _HOMEPAGE = "https://google.github.io/AstroCompress"
|
|
23 |
|
24 |
_LICENSE = "CC BY 4.0"
|
25 |
|
|
|
|
|
26 |
_URLS = {
|
27 |
"tiny": {
|
28 |
"train": "./splits/tiny_train.jsonl",
|
@@ -88,7 +90,7 @@ class GBI_16_4D(datasets.GeneratorBasedBuilder):
|
|
88 |
)
|
89 |
return ret
|
90 |
|
91 |
-
def _generate_examples(self, filepath, split):
|
92 |
"""Generate GBI-16-4D examples"""
|
93 |
|
94 |
with open(filepath, "r") as f:
|
@@ -96,7 +98,7 @@ class GBI_16_4D(datasets.GeneratorBasedBuilder):
|
|
96 |
for line in f:
|
97 |
task_instance_key = f"{self.config.name}-{split}-{idx}"
|
98 |
item = json.loads(line)
|
99 |
-
image_path = item["image"]
|
100 |
with fits.open(image_path, memmap=False) as hdul:
|
101 |
image_data = hdul[0].data
|
102 |
yield task_instance_key, {"image": image_data,
|
|
|
23 |
|
24 |
_LICENSE = "CC BY 4.0"
|
25 |
|
26 |
+
_URL = "https://huggingface.co/datasets/AstroCompress/GBI-16-4D/resolve/main/"
|
27 |
+
|
28 |
_URLS = {
|
29 |
"tiny": {
|
30 |
"train": "./splits/tiny_train.jsonl",
|
|
|
90 |
)
|
91 |
return ret
|
92 |
|
93 |
+
def _generate_examples(self, filepath, split, base_url=_URL):
|
94 |
"""Generate GBI-16-4D examples"""
|
95 |
|
96 |
with open(filepath, "r") as f:
|
|
|
98 |
for line in f:
|
99 |
task_instance_key = f"{self.config.name}-{split}-{idx}"
|
100 |
item = json.loads(line)
|
101 |
+
image_path = os.path.join(base_url, item["image"].split("./")[-1])
|
102 |
with fits.open(image_path, memmap=False) as hdul:
|
103 |
image_data = hdul[0].data
|
104 |
yield task_instance_key, {"image": image_data,
|