|
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) |
|
|