File size: 797 Bytes
a9fc171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from sentence_transformers import SentenceTransformer
from sentence_transformers.evaluation import InformationRetrievalEvaluator
import argparse
import json


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--model", type=str,
                        default="tintnguyen/bert-base-vi-uncased-st-3")

    args = parser.parse_args()
    model = SentenceTransformer(args.model)

    queries = json.load(open("queries.json", "r"))
    corpus = json.load(open("corpus.json", "r"))
    rels = json.load(open("rels.json", "r"))

    evaluator = InformationRetrievalEvaluator(
        queries=queries,
        corpus=corpus,
        relevant_docs=rels,
        name="aaa",
        show_progress_bar=True,
    )
    results = evaluator(model)

    print(results)