Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved fusion regression #2627

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1cb5ea1
add fusion
cadurosar Jan 26, 2024
fe7e529
Merge branch 'castorini:master' into master
cadurosar Jan 26, 2024
c626a7c
added cadurosar's code via a copy + paste and made changes to match p…
DanielKohn1208 May 1, 2024
4d702d0
merged cadurosar's code
DanielKohn1208 May 1, 2024
7db24a9
moved FuseRuns
DanielKohn1208 May 1, 2024
e7efd1b
merged cadurosar's code with modifications
DanielKohn1208 May 1, 2024
ebd8ed4
added run fusion to match pyserini implementation
DanielKohn1208 May 8, 2024
1b398af
added fusion feature
Stefan824 Sep 6, 2024
27b44df
modified arguments; added test cases
Stefan824 Sep 6, 2024
72e6e06
modified TrecRun class code style
Stefan824 Sep 6, 2024
5f7ec35
added comment
Stefan824 Sep 6, 2024
509049c
deleted test file from previous version
Stefan824 Sep 7, 2024
39f62a9
Added dependency for junit test
Stefan824 Sep 7, 2024
37e89fa
resolved formatting; merged trectools module to fusion
Stefan824 Sep 7, 2024
54c74b4
remove unused test cases
Stefan824 Sep 8, 2024
32e13c2
removed unused test files
Stefan824 Sep 8, 2024
6c648f7
Merge remote-tracking branch 'origin/master' into add-fusion
Stefan824 Sep 16, 2024
a9d7804
added fusion regression script paired with two yaml test files
Stefan824 Sep 23, 2024
e049e48
added md for test
Stefan824 Sep 23, 2024
bd0ce76
add cmd on test instruction
Stefan824 Sep 23, 2024
17ceb49
removed abundant dependency
Stefan824 Sep 23, 2024
6f550b1
revert unecessary change
Stefan824 Sep 23, 2024
f4644e1
resolved a minor decoding issue
Stefan824 Sep 23, 2024
0ea8369
added a yaml that is based on regression test run results
Stefan824 Sep 23, 2024
ec57e96
added doc for test2
Stefan824 Sep 23, 2024
042b678
typo
Stefan824 Sep 23, 2024
f2b6f4c
changed name for test yamls
Stefan824 Sep 23, 2024
d94c0f9
second attempt to revert src/main/resources/regression/beir-v1.0.0-ro…
Stefan824 Sep 24, 2024
f5871b9
fixed precision and added run_origins for fusion yaml
Stefan824 Sep 25, 2024
b7961f3
removed two yamls that use runs not from current regression experiments
Stefan824 Sep 29, 2024
ab33853
modified test instructions according to last commit
Stefan824 Sep 29, 2024
db12c79
add yaml file
Stefan824 Sep 30, 2024
9a419aa
removed old yaml
Stefan824 Sep 30, 2024
d9cff54
changed output naming
Stefan824 Oct 1, 2024
6491adb
improved regression script and yaml information
Stefan824 Nov 8, 2024
af1b5c8
removed abundant file
Stefan824 Nov 8, 2024
149b298
resolved formatting issues
Stefan824 Nov 8, 2024
5e8cea1
Merge branch 'master' into add-fusion-regression
Stefan824 Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main/python/run_fusion_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def construct_fusion_commands(yaml_data: dict) -> list:
return [
[
FUSE_COMMAND,
'-runs', ' '.join([run for run in yaml_data['runs']]),
'-runs', ' '.join(run['file'] for run in yaml_data['runs']),
'-output', method.get('output'),
'-method', method.get('name', 'average'),
'-k', str(method.get('k', 1000)),
Expand Down Expand Up @@ -166,6 +166,12 @@ def evaluate_and_verify(yaml_data: dict, dry_run: bool):
logger.error(f"Failed to load configuration file: {e}")
exit(1)

# Check existence of run files
for run in yaml_data['runs']:
if not os.path.exists(run['file']):
logger.error(f"Run file {run['file']} does not exist. Please run the dependent regressions first, recorded in the fusion yaml file.")
exit(1)

# Construct the fusion command
fusion_commands = construct_fusion_commands(yaml_data)

Expand All @@ -178,4 +184,4 @@ def evaluate_and_verify(yaml_data: dict, dry_run: bool):
# Evaluate and verify results
evaluate_and_verify(yaml_data, args.dry_run)

logger.info(f"Total execution time: {time.time() - start_time:.2f} seconds")
logger.info(f"Total execution time: {time.time() - start_time:.2f} seconds")
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
corpus: beir-v1.0.0-robust04
corpus_path: collections/beir-v1.0.0/corpus/robust04/

metrics:
- metric: nDCG@10
command: bin/trec_eval
params: -c -m ndcg_cut.10
separator: "\t"
parse_index: 2
metric_precision: 4
can_combine: false
- metric: R@100
command: bin/trec_eval
params: -c -m recall.100
separator: "\t"
parse_index: 2
metric_precision: 4
can_combine: false
- metric: R@1000
command: bin/trec_eval
params: -c -m recall.1000
separator: "\t"
parse_index: 2
metric_precision: 4
can_combine: false

topic_reader: TsvString
topics:
- name: "BEIR (v1.0.0): Robust04"
id: test
path: topics.beir-v1.0.0-robust04.test.tsv.gz
qrel: qrels.beir-v1.0.0-robust04.test.txt

# Run dependencies for fusion
runs:
- name: flat-bm25
dependency: beir-v1.0.0-robust04.flat.yaml
file: runs/run.beir-v1.0.0-robust04.flat.bm25.topics.beir-v1.0.0-robust04.test.txt
- name: bge-flat-onnx
dependency: beir-v1.0.0-robust04.bge-base-en-v1.5.flat.onnx.yaml
file: runs/run.beir-v1.0.0-robust04.bge-base-en-v1.5.bge-flat-onnx.topics.beir-v1.0.0-robust04.test.txt

methods:
- name: rrf
k: 1000
depth: 1000
rrf_k: 60
output: runs/runs.fuse.rrf.beir-v1.0.0-robust04.flat.bm25.bge-base-en-v1.5.bge-flat-onnx.topics.beir-v1.0.0-robust04.test.txt
results:
nDCG@10:
- 0.5070
R@100:
- 0.4465
R@1000:
- 0.7219
- name: average
output: runs/runs.fuse.avg.beir-v1.0.0-robust04.flat.bm25.bge-base-en-v1.5.bge-flat-onnx.topics.beir-v1.0.0-robust04.test.txt
results:
nDCG@10:
- 0.4324
R@100:
- 0.3963
R@1000:
- 0.6345
- name: interpolation
alpha: 0.5
output: runs/runs.fuse.interp.beir-v1.0.0-robust04.flat.bm25.bge-base-en-v1.5.bge-flat-onnx.topics.beir-v1.0.0-robust04.test.txt
results:
nDCG@10:
- 0.4324
R@100:
- 0.3963
R@1000:
- 0.6345