Update README.md
Browse files
README.md
CHANGED
|
@@ -33,37 +33,6 @@ This is reranking dataset built from 179 queris from [MSMARCO-V2 passages set](h
|
|
| 33 |
Below are the data creation process:
|
| 34 |
|
| 35 |
```
|
| 36 |
-
import sys
|
| 37 |
-
from pyserini.search import get_topics, get_qrels
|
| 38 |
-
from run_evaluation import THE_TOPICS, THE_INDEX
|
| 39 |
-
from trec_eval import EvalFunction
|
| 40 |
-
import json
|
| 41 |
-
qrels = {}
|
| 42 |
-
for data in ['dl21', 'dl22', 'dl23']:
|
| 43 |
-
qrels_file = get_qrels_file(THE_TOPICS[data])
|
| 44 |
-
with open(qrels_file, 'r') as f:
|
| 45 |
-
for line in f:
|
| 46 |
-
qid, _, docid, rel = line.strip().split()
|
| 47 |
-
if qid not in qrels:
|
| 48 |
-
qrels[qid] = {}
|
| 49 |
-
qrels[qid][docid] = int(rel)
|
| 50 |
-
|
| 51 |
-
# Save the combined qrels to a file
|
| 52 |
-
output_file = './combined_qrels.txt'
|
| 53 |
-
with open(output_file, 'w') as f:
|
| 54 |
-
for qid in sorted(qrels.keys()):
|
| 55 |
-
for docid, rel in qrels[qid].items():
|
| 56 |
-
f.write(f"{qid} 0 {docid} {rel}\n")
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
# Concate the files
|
| 60 |
-
combined_rank_results = []
|
| 61 |
-
for data in ['dl21', 'dl22', 'dl23']:
|
| 62 |
-
with open(f'{data}_bm25_rank_results.json', 'r') as f:
|
| 63 |
-
rank_results = json.load(f)
|
| 64 |
-
print(f"len(rank_results): {len(rank_results)}")
|
| 65 |
-
combined_rank_results.extend(rank_results)
|
| 66 |
-
|
| 67 |
# Multiple Random Sampling
|
| 68 |
|
| 69 |
import copy
|
|
@@ -80,21 +49,4 @@ for item in combined_rank_results:
|
|
| 80 |
replicate_rank_results.append(new_item)
|
| 81 |
print(len(replicate_rank_results))
|
| 82 |
|
| 83 |
-
# Push to huggingface
|
| 84 |
-
|
| 85 |
-
from datasets import Dataset
|
| 86 |
-
import pandas as pd
|
| 87 |
-
from huggingface_hub import login
|
| 88 |
-
df = pd.DataFrame(replicate_rank_results)
|
| 89 |
-
dataset = Dataset.from_pandas(df)
|
| 90 |
-
|
| 91 |
-
# Print dataset info
|
| 92 |
-
print(f"Dataset size: {len(dataset)}")
|
| 93 |
-
print(dataset)
|
| 94 |
-
|
| 95 |
-
# Upload the dataset to Huggingface Hub
|
| 96 |
-
dataset.push_to_hub(
|
| 97 |
-
"le723z/DeepRerank", # Replace with your desired repository name
|
| 98 |
-
private=False, # Set to True if you want a private dataset
|
| 99 |
-
)
|
| 100 |
```
|
|
|
|
| 33 |
Below are the data creation process:
|
| 34 |
|
| 35 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# Multiple Random Sampling
|
| 37 |
|
| 38 |
import copy
|
|
|
|
| 49 |
replicate_rank_results.append(new_item)
|
| 50 |
print(len(replicate_rank_results))
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```
|