Update lpbf_flare.py
Browse files- lpbf_flare.py +21 -0
lpbf_flare.py
CHANGED
|
@@ -42,6 +42,27 @@ class LPBFDataset(GeneratorBasedBuilder):
|
|
| 42 |
),
|
| 43 |
]
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
def _generate_examples(self, data_dir):
|
| 46 |
files = sorted([f for f in os.listdir(data_dir) if f.endswith(".pt")])
|
| 47 |
for idx, fname in enumerate(files):
|
|
|
|
| 42 |
),
|
| 43 |
]
|
| 44 |
|
| 45 |
+
def _split_generators(self, dl_manager):
|
| 46 |
+
"""
|
| 47 |
+
The dataset structure should look like:
|
| 48 |
+
LPBF/train/*.pt
|
| 49 |
+
LPBF/test/*.pt
|
| 50 |
+
"""
|
| 51 |
+
data_dir = dl_manager.download_and_extract(
|
| 52 |
+
"https://huggingface.co/datasets/vedantpuri/LPBFSurrogates/resolve/main/LPBF.tar.gz"
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
# if the tar contains a subdir called LPBF/
|
| 56 |
+
# then dl_manager extracts to something like: [...]/LPBF/
|
| 57 |
+
split_train = os.path.join(data_dir, "LPBF", "train")
|
| 58 |
+
split_test = os.path.join(data_dir, "LPBF", "test")
|
| 59 |
+
|
| 60 |
+
return [
|
| 61 |
+
SplitGenerator(name=Split.TRAIN, gen_kwargs={"data_dir": split_train}),
|
| 62 |
+
SplitGenerator(name=Split.TEST, gen_kwargs={"data_dir": split_test}),
|
| 63 |
+
]
|
| 64 |
+
|
| 65 |
+
|
| 66 |
def _generate_examples(self, data_dir):
|
| 67 |
files = sorted([f for f in os.listdir(data_dir) if f.endswith(".pt")])
|
| 68 |
for idx, fname in enumerate(files):
|