FranciscoLozDataScience commited on
Commit
f608c8a
1 Parent(s): 91ec6ce

changed the script to include prompt and choice

Browse files
Files changed (1) hide show
  1. smokedataset.py +8 -18
smokedataset.py CHANGED
@@ -24,6 +24,8 @@ _NAMES = [
24
  "smoke"
25
  ]
26
 
 
 
27
 
28
  class smokedataset(datasets.GeneratorBasedBuilder):
29
 
@@ -38,7 +40,9 @@ class smokedataset(datasets.GeneratorBasedBuilder):
38
  features= datasets.Features(
39
  {
40
  "image": datasets.Image(),
41
- "label": datasets.ClassLabel(names=_NAMES)
 
 
42
  }
43
  ),
44
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
@@ -62,22 +66,6 @@ class smokedataset(datasets.GeneratorBasedBuilder):
62
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
63
  data_dir = dl_manager.download(_URLS)
64
  return [
65
- datasets.SplitGenerator(
66
- name=datasets.Split.TRAIN,
67
- # These kwargs will be passed to _generate_examples
68
- gen_kwargs={
69
- "images": dl_manager.iter_archive(data_dir),
70
- "split": "train"
71
- },
72
- ),
73
- datasets.SplitGenerator(
74
- name=datasets.Split.VALIDATION,
75
- # These kwargs will be passed to _generate_examples
76
- gen_kwargs={
77
- "images": dl_manager.iter_archive(data_dir),
78
- "split": "val"
79
- },
80
- ),
81
  datasets.SplitGenerator(
82
  name=datasets.Split.TEST,
83
  # These kwargs will be passed to _generate_examples
@@ -96,5 +84,7 @@ class smokedataset(datasets.GeneratorBasedBuilder):
96
  if splitfolder == split:
97
  yield file_path,{
98
  "image": {"path": file_path, "bytes": file_obj.read()},
99
- "label": label
 
 
100
  }
 
24
  "smoke"
25
  ]
26
 
27
+ _PROMPT = "What is shown in the image?"
28
+ _CHOICES = _NAMES
29
 
30
  class smokedataset(datasets.GeneratorBasedBuilder):
31
 
 
40
  features= datasets.Features(
41
  {
42
  "image": datasets.Image(),
43
+ "label": datasets.ClassLabel(names=_NAMES),
44
+ "prompt": _PROMPT,
45
+ "choices": _CHOICES
46
  }
47
  ),
48
  # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
 
66
  # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
67
  data_dir = dl_manager.download(_URLS)
68
  return [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  datasets.SplitGenerator(
70
  name=datasets.Split.TEST,
71
  # These kwargs will be passed to _generate_examples
 
84
  if splitfolder == split:
85
  yield file_path,{
86
  "image": {"path": file_path, "bytes": file_obj.read()},
87
+ "label": label,
88
+ "prompt": _PROMPT,
89
+ "choices": _CHOICES
90
  }