Cie1 commited on
Commit
9aba928
·
verified ·
1 Parent(s): d9c7de9

Update MMSearch-Plus dataset with encrypted data files

Browse files
Files changed (1) hide show
  1. mmsearch_plus.py +4 -30
mmsearch_plus.py CHANGED
@@ -78,7 +78,7 @@ class MmsearchPlus(datasets.GeneratorBasedBuilder):
78
  VERSION = datasets.Version("1.0.0")
79
 
80
  def _info(self):
81
- # Define features to handle the complete encrypted dataset schema
82
  features = datasets.Features({
83
  "question": datasets.Value("string"),
84
  "answer": datasets.Sequence(datasets.Value("string")),
@@ -88,18 +88,12 @@ class MmsearchPlus(datasets.GeneratorBasedBuilder):
88
  "category": datasets.Value("string"),
89
  "difficulty": datasets.Value("string"),
90
  "subtask": datasets.Value("string"),
91
- # Final decrypted image fields (what users will see)
92
  "img_1": datasets.Image(),
93
  "img_2": datasets.Image(),
94
  "img_3": datasets.Image(),
95
  "img_4": datasets.Image(),
96
  "img_5": datasets.Image(),
97
- # Encrypted fields (handled internally, removed after decryption)
98
- "encrypted_img_1": datasets.Value("string"),
99
- "encrypted_img_2": datasets.Value("string"),
100
- "encrypted_img_3": datasets.Value("string"),
101
- "encrypted_img_4": datasets.Value("string"),
102
- "encrypted_img_5": datasets.Value("string"),
103
  # Additional fields that might exist in the dataset
104
  "choices": datasets.Sequence(datasets.Value("string")),
105
  "question_zh": datasets.Value("string"),
@@ -189,28 +183,8 @@ class MmsearchPlus(datasets.GeneratorBasedBuilder):
189
  decrypted_answers.append(answer)
190
  example["answer"] = decrypted_answers
191
 
192
- # Decrypt image fields - handle both original and renamed encrypted fields
193
- image_field_mapping = {
194
- "encrypted_img_1": "img_1",
195
- "encrypted_img_2": "img_2",
196
- "encrypted_img_3": "img_3",
197
- "encrypted_img_4": "img_4",
198
- "encrypted_img_5": "img_5",
199
- # Also handle original field names for backward compatibility
200
- "img_1": "img_1",
201
- "img_2": "img_2",
202
- "img_3": "img_3",
203
- "img_4": "img_4",
204
- "img_5": "img_5"
205
- }
206
-
207
- for encrypted_field, decrypted_field in image_field_mapping.items():
208
- if example.get(encrypted_field):
209
- decrypted_image = decrypt_image(example[encrypted_field], canary)
210
- example[decrypted_field] = decrypted_image
211
- # Remove the encrypted field if it's not the same as decrypted field
212
- if encrypted_field != decrypted_field and encrypted_field in example:
213
- del example[encrypted_field]
214
 
215
  yield key, example
216
  key += 1
 
78
  VERSION = datasets.Version("1.0.0")
79
 
80
  def _info(self):
81
+ # Define features to handle the complete dataset schema
82
  features = datasets.Features({
83
  "question": datasets.Value("string"),
84
  "answer": datasets.Sequence(datasets.Value("string")),
 
88
  "category": datasets.Value("string"),
89
  "difficulty": datasets.Value("string"),
90
  "subtask": datasets.Value("string"),
91
+ # Image fields (not encrypted, kept as PIL Images)
92
  "img_1": datasets.Image(),
93
  "img_2": datasets.Image(),
94
  "img_3": datasets.Image(),
95
  "img_4": datasets.Image(),
96
  "img_5": datasets.Image(),
 
 
 
 
 
 
97
  # Additional fields that might exist in the dataset
98
  "choices": datasets.Sequence(datasets.Value("string")),
99
  "question_zh": datasets.Value("string"),
 
183
  decrypted_answers.append(answer)
184
  example["answer"] = decrypted_answers
185
 
186
+ # Images are not encrypted - they remain as PIL Image objects
187
+ # No image decryption needed as per the encryption script
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
  yield key, example
190
  key += 1