Update script to use hosted data file
Browse files
fashion_mnist_corrupted.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
This module contains the huggingface dataset adaptation of
|
4 |
the Corrupted Fashion-Mnist Data Set.
|
5 |
Find the full code at `https://github.com/testingautomated-usi/fashion-mnist-c`."""
|
6 |
-
import
|
7 |
|
8 |
import datasets
|
9 |
import numpy as np
|
@@ -38,11 +38,9 @@ if CONFIG.version == datasets.Version("1.0.0"):
|
|
38 |
else:
|
39 |
raise ValueError("Unsupported version.")
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
_URLS = {
|
46 |
"train_images": "fmnist-c-train.npy",
|
47 |
"train_labels": "fmnist-c-train-labels.npy",
|
48 |
"test_images": "fmnist-c-test.npy",
|
@@ -86,10 +84,10 @@ class FashionMnistCorrupted(datasets.GeneratorBasedBuilder):
|
|
86 |
)
|
87 |
|
88 |
def _split_generators(self, dl_manager):
|
89 |
-
|
90 |
-
|
|
|
91 |
}
|
92 |
-
downloaded_files = dl_manager.download(urls_to_download)
|
93 |
|
94 |
return [
|
95 |
datasets.SplitGenerator(
|
|
|
3 |
This module contains the huggingface dataset adaptation of
|
4 |
the Corrupted Fashion-Mnist Data Set.
|
5 |
Find the full code at `https://github.com/testingautomated-usi/fashion-mnist-c`."""
|
6 |
+
import os.path
|
7 |
|
8 |
import datasets
|
9 |
import numpy as np
|
|
|
38 |
else:
|
39 |
raise ValueError("Unsupported version.")
|
40 |
|
41 |
+
# Downloaded from: f"https://raw.githubusercontent.com/testingautomated-usi/fashion-mnist-c/{tag}/generated/npy/
|
42 |
+
_URL = "data.zip"
|
43 |
+
_FILENAMES = {
|
|
|
|
|
44 |
"train_images": "fmnist-c-train.npy",
|
45 |
"train_labels": "fmnist-c-train-labels.npy",
|
46 |
"test_images": "fmnist-c-test.npy",
|
|
|
84 |
)
|
85 |
|
86 |
def _split_generators(self, dl_manager):
|
87 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
88 |
+
downloaded_files = {
|
89 |
+
key: os.path.join(data_dir, fname) for key, fname in _FILENAMES.items()
|
90 |
}
|
|
|
91 |
|
92 |
return [
|
93 |
datasets.SplitGenerator(
|