fdschmidt93 commited on
Commit
ef940c3
·
1 Parent(s): 9638448

chore(dataset): remove prompt

Browse files
Files changed (1) hide show
  1. mvl-sib200.py +1 -22
mvl-sib200.py CHANGED
@@ -68,20 +68,6 @@ CATEGORIES: List[str] = [
68
  "travel",
69
  ]
70
 
71
- # Prompts for classification tasks
72
- IMG2SENT_PROMPT: str = (
73
- "Which option best matches the topic of the reference image(s)? "
74
- 'The available topics are "entertainment", "geograpy", "health", '
75
- '"politics", "science and technology", "sports", and "travel". '
76
- "Choose one from A, B, C, D and only output a single letter."
77
- )
78
- SENT2IMG_PROMPT: str = (
79
- "Which option best matches the topic of the reference sentence(s)? "
80
- 'The available topics are "entertainment", "geograpy", "health", '
81
- '"politics", "science and technology", "sports", and "travel". '
82
- "Choose one from A, B, C, D and only output a single letter."
83
- )
84
-
85
  # URLs for downloading SIB .tsv data and images.
86
  _SIB_URL: str = "https://huggingface.co/datasets/wuenlp/mvl-sib200/resolve/main/data/sib200/{lang}/{split}.tsv"
87
  _IMG_URL: str = "https://huggingface.co/datasets/wuenlp/mvl-sib200/resolve/main/data/images/sib200/{category}_{no}.jpg"
@@ -277,7 +263,7 @@ def replicate_and_negatives(
277
 
278
  for cat, group_df in grouped:
279
  g_size = len(group_df)
280
-
281
  # The preallocated arrays for negative and positive columns will be filled for each row individually, i.e., sampling of negative categories and samples will be done per row
282
  # Prepare arrays for final negative columns
283
  neg_id_cols = [np.empty(g_size, dtype=object) for _ in range(num_negatives)]
@@ -472,7 +458,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
472
  The dataset is structured such that each row includes:
473
  - A set of reference items (images or sentences, depending on the task).
474
  - A set of 4 possible answers (1 positive, 3 negative).
475
- - A prompt instructing the user to pick the correct match.
476
  - A label indicating which of the 4 answers is correct.
477
  """
478
 
@@ -494,7 +479,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
494
  - label (int specifying which of the sentences is correct)
495
  - id (an integer ID)
496
  - index_id (the original row ID from the SIB .tsv)
497
- - prompt (str, the classification prompt)
498
 
499
  Each example row in 'sent2img' includes:
500
  - sentences (list of str, the positive reference sentences)
@@ -503,7 +487,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
503
  - label (int specifying which of the images is correct)
504
  - id (an integer ID)
505
  - index_id (the original row ID from the SIB .tsv)
506
- - prompt (str, the classification prompt)
507
 
508
  Returns
509
  -------
@@ -518,7 +501,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
518
  "images": Sequence(Value("string")),
519
  "sentences": Sequence(Value("string")),
520
  "categories": Sequence(Value("string")),
521
- "prompt": Value("string"),
522
  "label": Value("int8"),
523
  "id": Value("int64"),
524
  "index_id": Value("int64"),
@@ -532,7 +514,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
532
  "label": Value("int8"),
533
  "id": Value("int64"),
534
  "index_id": Value("int64"),
535
- "prompt": Value("string"),
536
  }
537
  )
538
 
@@ -673,7 +654,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
673
  i,
674
  {
675
  "id": i,
676
- "prompt": IMG2SENT_PROMPT,
677
  "index_id": row["index_id"],
678
  "images": row_images,
679
  "categories": categories_shuffled,
@@ -717,7 +697,6 @@ class MVLSIB(datasets.GeneratorBasedBuilder):
717
  i,
718
  {
719
  "id": i,
720
- "prompt": SENT2IMG_PROMPT,
721
  "index_id": row["index_id"],
722
  "images": row_images,
723
  "categories": categories_shuffled,
 
68
  "travel",
69
  ]
70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  # URLs for downloading SIB .tsv data and images.
72
  _SIB_URL: str = "https://huggingface.co/datasets/wuenlp/mvl-sib200/resolve/main/data/sib200/{lang}/{split}.tsv"
73
  _IMG_URL: str = "https://huggingface.co/datasets/wuenlp/mvl-sib200/resolve/main/data/images/sib200/{category}_{no}.jpg"
 
263
 
264
  for cat, group_df in grouped:
265
  g_size = len(group_df)
266
+
267
  # The preallocated arrays for negative and positive columns will be filled for each row individually, i.e., sampling of negative categories and samples will be done per row
268
  # Prepare arrays for final negative columns
269
  neg_id_cols = [np.empty(g_size, dtype=object) for _ in range(num_negatives)]
 
458
  The dataset is structured such that each row includes:
459
  - A set of reference items (images or sentences, depending on the task).
460
  - A set of 4 possible answers (1 positive, 3 negative).
 
461
  - A label indicating which of the 4 answers is correct.
462
  """
463
 
 
479
  - label (int specifying which of the sentences is correct)
480
  - id (an integer ID)
481
  - index_id (the original row ID from the SIB .tsv)
 
482
 
483
  Each example row in 'sent2img' includes:
484
  - sentences (list of str, the positive reference sentences)
 
487
  - label (int specifying which of the images is correct)
488
  - id (an integer ID)
489
  - index_id (the original row ID from the SIB .tsv)
 
490
 
491
  Returns
492
  -------
 
501
  "images": Sequence(Value("string")),
502
  "sentences": Sequence(Value("string")),
503
  "categories": Sequence(Value("string")),
 
504
  "label": Value("int8"),
505
  "id": Value("int64"),
506
  "index_id": Value("int64"),
 
514
  "label": Value("int8"),
515
  "id": Value("int64"),
516
  "index_id": Value("int64"),
 
517
  }
518
  )
519
 
 
654
  i,
655
  {
656
  "id": i,
 
657
  "index_id": row["index_id"],
658
  "images": row_images,
659
  "categories": categories_shuffled,
 
697
  i,
698
  {
699
  "id": i,
 
700
  "index_id": row["index_id"],
701
  "images": row_images,
702
  "categories": categories_shuffled,