Diwank Singh Tomer commited on
Commit ·
2c35e34
1
Parent(s): cd42ae4
fix: os import and duplicate keys
Browse filesSigned-off-by: Diwank Singh Tomer <diwank.singh@gmail.com>
lld.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
"""Dataset class for LLD dataset."""
|
| 2 |
|
|
|
|
|
|
|
| 3 |
import datasets as ds
|
| 4 |
import pandas as pd
|
| 5 |
from sklearn.model_selection import train_test_split
|
|
@@ -43,6 +45,8 @@ class LLD(ds.GeneratorBasedBuilder):
|
|
| 43 |
def _split_generators(self, dl_manager):
|
| 44 |
# Load dataframe
|
| 45 |
use_local = os.environ.get("USE_LOCAL")
|
|
|
|
|
|
|
| 46 |
archive_path = (
|
| 47 |
"./data/lld-processed.h5" if use_local else dl_manager.download(_URL)
|
| 48 |
)
|
|
@@ -73,8 +77,8 @@ class LLD(ds.GeneratorBasedBuilder):
|
|
| 73 |
"""Generate images and description splits."""
|
| 74 |
|
| 75 |
for i, (desc, imgs) in enumerate(zip(description.values, images.values)):
|
| 76 |
-
for img in imgs:
|
| 77 |
-
yield i, {
|
| 78 |
"image": {"bytes": img},
|
| 79 |
"description": desc,
|
| 80 |
}
|
|
|
|
| 1 |
"""Dataset class for LLD dataset."""
|
| 2 |
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
import datasets as ds
|
| 6 |
import pandas as pd
|
| 7 |
from sklearn.model_selection import train_test_split
|
|
|
|
| 45 |
def _split_generators(self, dl_manager):
|
| 46 |
# Load dataframe
|
| 47 |
use_local = os.environ.get("USE_LOCAL")
|
| 48 |
+
print(f"local: {bool(use_local)}")
|
| 49 |
+
|
| 50 |
archive_path = (
|
| 51 |
"./data/lld-processed.h5" if use_local else dl_manager.download(_URL)
|
| 52 |
)
|
|
|
|
| 77 |
"""Generate images and description splits."""
|
| 78 |
|
| 79 |
for i, (desc, imgs) in enumerate(zip(description.values, images.values)):
|
| 80 |
+
for j, img in enumerate(imgs):
|
| 81 |
+
yield f"{i}-{j}", {
|
| 82 |
"image": {"bytes": img},
|
| 83 |
"description": desc,
|
| 84 |
}
|