arbarikcp commited on
Commit
cc43de0
·
1 Parent(s): 3c30810

fixing id column to hf id

Browse files
Files changed (2) hide show
  1. app/app.py +3 -3
  2. src/data/ragbench_loader.py +1 -2
app/app.py CHANGED
@@ -116,10 +116,10 @@ def _sample_choices(dataset: str, seed: int = 42) -> list:
116
  rel = _fmt_gold(row, "relevance_score")
117
  util = _fmt_gold(row, "utilization_score")
118
  comp = _fmt_gold(row, "completeness_score")
119
- # Use the real HF split + row index when available (loader v2+), else fall back to local pos
120
  split_name = row.get("source_split", "?")
121
- hf_idx = int(row["source_row_idx"]) if "source_row_idx" in row.index and not pd.isna(row["source_row_idx"]) else i
122
- label = f"{truncated} [{split_name}#{hf_idx}] adh={adh} rel={rel} util={util} comp={comp}"
123
  choices.append((label, i))
124
  return choices
125
 
 
116
  rel = _fmt_gold(row, "relevance_score")
117
  util = _fmt_gold(row, "utilization_score")
118
  comp = _fmt_gold(row, "completeness_score")
119
+ # Use the real HF id column and split name for cross-referencing in the dataset viewer
120
  split_name = row.get("source_split", "?")
121
+ hf_id = int(row["id"]) if "id" in row.index and not pd.isna(row["id"]) else i
122
+ label = f"{truncated} [{split_name} id={hf_id}] adh={adh} rel={rel} util={util} comp={comp}"
123
  choices.append((label, i))
124
  return choices
125
 
src/data/ragbench_loader.py CHANGED
@@ -20,8 +20,7 @@ def load_ragbench_config(config_name: str) -> pd.DataFrame:
20
  ds = load_dataset("rungalileo/ragbench", config_name)
21
  df = pd.concat(
22
  [
23
- ds[split].to_pandas()
24
- .assign(source_split=split, source_row_idx=range(len(ds[split])))
25
  for split in ds.keys()
26
  ],
27
  ignore_index=True,
 
20
  ds = load_dataset("rungalileo/ragbench", config_name)
21
  df = pd.concat(
22
  [
23
+ ds[split].to_pandas().assign(source_split=split)
 
24
  for split in ds.keys()
25
  ],
26
  ignore_index=True,