philipphager commited on
Commit
50f15fe
1 Parent(s): b8c641d

Update baidu-ultr_baidu-mlm-ctr.py

Browse files
Files changed (1) hide show
  1. baidu-ultr_baidu-mlm-ctr.py +4 -4
baidu-ultr_baidu-mlm-ctr.py CHANGED
@@ -264,7 +264,7 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
264
 
265
  for file in files:
266
  df = pd.read_feather(file)
267
- current_query_id = None
268
  query_no = 0
269
  sample_key = None
270
  sample = None
@@ -272,13 +272,13 @@ class BaiduUltrBuilder(datasets.GeneratorBasedBuilder):
272
  for i in range(len(df)):
273
  row = df.iloc[i]
274
 
275
- if current_query_id != row["query_id"]:
276
  query_no += 1
277
 
278
- if current_query_id is not None:
279
  yield sample_key, sample
280
 
281
- current_query_id = row["query_id"]
282
  # Use the query number in sample_key as query_ids are not unique.
283
  sample_key = f"{file}-{query_no}"
284
  sample = {"n": 0}
 
264
 
265
  for file in files:
266
  df = pd.read_feather(file)
267
+ current_query = None
268
  query_no = 0
269
  sample_key = None
270
  sample = None
 
272
  for i in range(len(df)):
273
  row = df.iloc[i]
274
 
275
+ if current_query != row["query_md5"]:
276
  query_no += 1
277
 
278
+ if current_query is not None:
279
  yield sample_key, sample
280
 
281
+ current_query = row["query_md5"]
282
  # Use the query number in sample_key as query_ids are not unique.
283
  sample_key = f"{file}-{query_no}"
284
  sample = {"n": 0}