Testing image dataset upload
Browse files- faceid-data2.py +0 -78
- train.parquet +3 -0
- validation.parquet +3 -0
faceid-data2.py
DELETED
|
@@ -1,78 +0,0 @@
|
|
| 1 |
-
# dataset_script.py
|
| 2 |
-
import os
|
| 3 |
-
import json
|
| 4 |
-
from pathlib import Path
|
| 5 |
-
|
| 6 |
-
import datasets
|
| 7 |
-
from datasets import (
|
| 8 |
-
GeneratorBasedBuilder,
|
| 9 |
-
DatasetInfo,
|
| 10 |
-
SplitGenerator,
|
| 11 |
-
Features,
|
| 12 |
-
Sequence,
|
| 13 |
-
Value,
|
| 14 |
-
Image
|
| 15 |
-
)
|
| 16 |
-
|
| 17 |
-
_CITATION = """\
|
| 18 |
-
@misc{faceid2025,
|
| 19 |
-
title={FaceID for nanoVLM},
|
| 20 |
-
author={Your Name},
|
| 21 |
-
year={2025},
|
| 22 |
-
}
|
| 23 |
-
"""
|
| 24 |
-
|
| 25 |
-
_DESCRIPTION = """
|
| 26 |
-
FaceID dataset: for each image, a single-question Q&A pair:
|
| 27 |
-
"Question: Who is the person?" → "Answer: <Name>"
|
| 28 |
-
"""
|
| 29 |
-
|
| 30 |
-
class FaceIDDataset(GeneratorBasedBuilder):
|
| 31 |
-
|
| 32 |
-
VERSION = datasets.Version("1.0.0")
|
| 33 |
-
|
| 34 |
-
def _info(self):
|
| 35 |
-
return DatasetInfo(
|
| 36 |
-
description=_DESCRIPTION,
|
| 37 |
-
features=Features({
|
| 38 |
-
# a *list* of images (we only have one per example, but must match your JSONL)
|
| 39 |
-
"images": Sequence(feature=Image(decode=True)),
|
| 40 |
-
# a list of QA dicts
|
| 41 |
-
"texts": Sequence({
|
| 42 |
-
"user": Value("string"),
|
| 43 |
-
"assistant": Value("string"),
|
| 44 |
-
"source": Value("string"),
|
| 45 |
-
}),
|
| 46 |
-
}),
|
| 47 |
-
supervised_keys=None,
|
| 48 |
-
homepage="https://huggingface.co/datasets/AgtOwad/faceid-data2",
|
| 49 |
-
citation=_CITATION,
|
| 50 |
-
)
|
| 51 |
-
|
| 52 |
-
def _split_generators(self, dl_manager):
|
| 53 |
-
# we already have JSONL + images in the same folder, no download needed
|
| 54 |
-
data_dir = Path(__file__).parent
|
| 55 |
-
return [
|
| 56 |
-
SplitGenerator(name=datasets.Split.TRAIN,
|
| 57 |
-
gen_kwargs={"jsonl": data_dir / "train.jsonl"}),
|
| 58 |
-
SplitGenerator(name=datasets.Split.VALIDATION,
|
| 59 |
-
gen_kwargs={"jsonl": data_dir / "val.jsonl"}),
|
| 60 |
-
]
|
| 61 |
-
|
| 62 |
-
def _generate_examples(self, jsonl):
|
| 63 |
-
base = Path(__file__).parent
|
| 64 |
-
with open(jsonl, "r", encoding="utf-8") as f:
|
| 65 |
-
for idx, line in enumerate(f):
|
| 66 |
-
ex = json.loads(line)
|
| 67 |
-
# images is a list of relative paths under this repo
|
| 68 |
-
img_list = [ str(base / p) for p in ex["images"] ]
|
| 69 |
-
yield idx, {
|
| 70 |
-
"images": img_list,
|
| 71 |
-
"texts": ex["texts"]
|
| 72 |
-
}
|
| 73 |
-
|
| 74 |
-
# if __name__ == "__main__":
|
| 75 |
-
# # this block is optional—your script will be discovered automatically by load_dataset
|
| 76 |
-
# from datasets import load_dataset
|
| 77 |
-
# ds = load_dataset(__file__)
|
| 78 |
-
# print(ds)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:23bcf89d983d77cf76f090d231e5988609eea97441d6f3d0508b13322e9daa4d
|
| 3 |
+
size 3880355
|
validation.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05bf1fc02d4a9d8287db5d6863bffddfa92395f64f01486fbb039168ada472ba
|
| 3 |
+
size 858080
|