AgtOwad commited on
Commit
a009a00
·
1 Parent(s): 7d14446

Testing image dataset upload

Browse files
Files changed (2) hide show
  1. faceid-data2.py +7 -1
  2. my_dataset.py +0 -72
faceid-data2.py CHANGED
@@ -45,7 +45,7 @@ class FaceIDDataset(GeneratorBasedBuilder):
45
  }),
46
  }),
47
  supervised_keys=None,
48
- homepage="https://huggingface.co/datasets/your-username/faceid-data2",
49
  citation=_CITATION,
50
  )
51
 
@@ -70,3 +70,9 @@ class FaceIDDataset(GeneratorBasedBuilder):
70
  "images": img_list,
71
  "texts": ex["texts"]
72
  }
 
 
 
 
 
 
 
45
  }),
46
  }),
47
  supervised_keys=None,
48
+ homepage="https://huggingface.co/datasets/AgtOwad/faceid-data2",
49
  citation=_CITATION,
50
  )
51
 
 
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)
my_dataset.py DELETED
@@ -1,72 +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/your-username/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
- }