mixed-modality-search commited on
Commit
247acc2
·
verified ·
1 Parent(s): 15780bf

Add files using upload-large-folder tool

Browse files
Files changed (1) hide show
  1. MixBench25.py +15 -7
MixBench25.py CHANGED
@@ -65,15 +65,23 @@ class MixBench(datasets.GeneratorBasedBuilder):
65
 
66
  def _generate_examples(self, path, split):
67
  if split == "qrel":
 
 
 
 
 
 
 
 
 
 
68
  with open(path, encoding="utf-8") as f:
69
- for idx, line in enumerate(f):
70
- qid, did, score = line.strip().split()
71
  yield idx, {
72
- "query_id": qid,
73
- "corpus_id": did,
74
- "text": "",
75
- "image": "",
76
- "score": int(score),
77
  }
78
  else:
79
  with open(path, encoding="utf-8") as f:
 
65
 
66
  def _generate_examples(self, path, split):
67
  if split == "qrel":
68
+ # with open(path, encoding="utf-8") as f:
69
+ # for idx, line in enumerate(f):
70
+ # qid, did, score = line.strip().split()
71
+ # yield idx, {
72
+ # "query_id": qid,
73
+ # "corpus_id": did,
74
+ # "text": "",
75
+ # "image": "",
76
+ # "score": int(score),
77
+ # }
78
  with open(path, encoding="utf-8") as f:
79
+ reader = csv.DictReader(f, delimiter="\t") # 使用 DictReader 读取有表头的 tsv
80
+ for idx, row in enumerate(reader):
81
  yield idx, {
82
+ "query_id": row["query_id"],
83
+ "corpus_id": row["corpus_id"],
84
+ "score": int(row["score"]),
 
 
85
  }
86
  else:
87
  with open(path, encoding="utf-8") as f: