tttoaster commited on
Commit
a84e2b0
1 Parent(s): f12fa46

Upload 7 files

Browse files
.gitattributes CHANGED
@@ -54,3 +54,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
  SEED-Bench_v2_level1_2_3.json filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
  SEED-Bench_v2_level1_2_3.json filter=lfs diff=lfs merge=lfs -text
57
+ SEED-Bench-2-image.zip.001 filter=lfs diff=lfs merge=lfs -text
58
+ SEED-Bench-2-image.zip.002 filter=lfs diff=lfs merge=lfs -text
59
+ SEED-Bench-2-image.zip.003 filter=lfs diff=lfs merge=lfs -text
60
+ SEED-Bench-2-image.zip.004 filter=lfs diff=lfs merge=lfs -text
61
+ SEED-Bench-2-image.zip.005 filter=lfs diff=lfs merge=lfs -text
62
+ SEED-Bench-2-image.zip.006 filter=lfs diff=lfs merge=lfs -text
SEED-Bench-2-image.zip.001 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ef9e31a2a03bd5210757250489420d9bb8f70514ccd08b2649d9299a17f9be50
3
+ size 734003200
SEED-Bench-2-image.zip.002 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b74c333cf912754c442c4e604133125fa5c33853ed49a8e2833600106966b307
3
+ size 734003200
SEED-Bench-2-image.zip.003 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adcae6471def6be6423d59e92e57ccc54e50a26c732df8efbc22f3799cd7303b
3
+ size 734003200
SEED-Bench-2-image.zip.004 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7452e16d938ec30239d7a4588b26f481240c2686efecabea35bebb4505ddf132
3
+ size 734003200
SEED-Bench-2-image.zip.005 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adfeb6c7c4fb950b6d829a9c615b0f336208c141b2c80194a5f8eb083dfe8e4d
3
+ size 734003200
SEED-Bench-2-image.zip.006 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e22c1dc1d2f0aba22683689457bb0abcdfc00e43198cbe9b17eb11ab1edca198
3
+ size 734003200
SEED-Bench-2.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import pdb
4
+
5
+ import datasets
6
+
7
+
8
+ _BASE_URL = "https://huggingface.co/datasets/AILab-CVC/SEED-Bench-2/raw/main/SEED-Bench_v2_level1_2_3.json"
9
+
10
+
11
+ class SEEDBenchDataset(datasets.GeneratorBasedBuilder):
12
+ VERSION = datasets.Version("1.0.0")
13
+
14
+ BUILDER_CONFIGS = [
15
+ datasets.BuilderConfig(name="default", version=VERSION, description="SEED-Bench-2 dataset"),
16
+ ]
17
+
18
+ DEFAULT_CONFIG_NAME = "default"
19
+
20
+ def _info(self):
21
+ return datasets.DatasetInfo(
22
+ features=datasets.Features(
23
+ {
24
+ "answer": datasets.Value("string"),
25
+ "choice_a": datasets.Value("string"),
26
+ "choice_b": datasets.Value("string"),
27
+ "choice_c": datasets.Value("string"),
28
+ "choice_d": datasets.Value("string"),
29
+ "data_id": datasets.Value("string"),
30
+ "data_source": datasets.Value("string"),
31
+ "data_type": datasets.Value("string"),
32
+ "level": datasets.Value("string"),
33
+ "question": datasets.Value("string"),
34
+ "question_id": datasets.Value("string"),
35
+ "question_type_id": datasets.Value("string"),
36
+ "subpart": datasets.Value("string"),
37
+ "version": datasets.Value("string"),
38
+ }
39
+ ),
40
+ supervised_keys=None,
41
+ )
42
+
43
+ def _split_generators(self, dl_manager):
44
+ urls_to_download = {"data_file": _BASE_URL}
45
+ downloaded_files = dl_manager.download_and_extract(urls_to_download)
46
+ # 为数据集创建一个测试拆分
47
+ return [
48
+ datasets.SplitGenerator(
49
+ name=datasets.Split.TEST,
50
+ gen_kwargs={"data_file": downloaded_files["data_file"]},
51
+ ),
52
+ ]
53
+
54
+ def _generate_examples(self, data_file):
55
+ # pdb.set_trace()
56
+ with open(data_file, 'r') as f:
57
+ data = json.load(f)
58
+
59
+ for item in data["questions"]:
60
+ # 提取数据集中的每个字段
61
+ answer = item["answer"]
62
+ choice_a = item["choice_a"]
63
+ choice_b = item["choice_b"]
64
+ choice_c = item["choice_c"]
65
+ choice_d = item["choice_d"]
66
+ data_id = item["data_id"]
67
+ data_source = item["data_source"]
68
+ data_type = item["data_type"]
69
+ level = item["level"]
70
+ question = item["question"]
71
+ question_id = item["question_id"]
72
+ question_type_id = item["question_type_id"]
73
+ subpart = item['subpart']
74
+ version = item['version']
75
+
76
+ # 返回一个包含数据集特征的字典
77
+ yield question_id, {
78
+ "answer": answer,
79
+ "choice_a": choice_a,
80
+ "choice_b": choice_b,
81
+ "choice_c": choice_c,
82
+ "choice_d": choice_d,
83
+ "data_id": data_id,
84
+ "data_source": data_source,
85
+ "data_type": data_type,
86
+ "level": level,
87
+ "question": question,
88
+ "question_id": question_id,
89
+ "question_type_id": question_type_id,
90
+ "subpart": subpart,
91
+ "version": version,
92
+ }