Skip to content
Snippets Groups Projects
Commit 66dcab41 authored by ivan.pavlovic's avatar ivan.pavlovic
Browse files

Tests with bge_m3_zeroshot_v2

parent 3227fa26
No related branches found
No related tags found
No related merge requests found
File added
# https://huggingface.co/MoritzLaurer/bge-m3-zeroshot-v2.0
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/bge-m3-zeroshot-v2.0")
candidate_labels = [
"Diabetes",
"Cancer",
"Chronic respiratory disease",
"Cardiovascular diseases",
"Mental Health",
"Diabetes type 1",
"Diabetes type 2"
]
def classify(sequence):
results = classifier(sequence, candidate_labels)
return results
# print(f"Sequence: {sequence_to_classify}")
# print(f"Labels: {results["labels"]}")
# print(f"Scores: {results["scores"]}")
This diff is collapsed.
......@@ -9,7 +9,8 @@ import time
import statistics
# from model.HuggingFace.BartLargeMnli import classify
from model.HuggingFace.BioMedBERT import classify
# from model.HuggingFace.BioMedBERT import classify
from model.HuggingFace.bge_m3_zeroshot_v2 import classify
TRESHOLD = 0.6
......@@ -36,7 +37,8 @@ def predict(article, file):
return classify(title + " \n " + articleTitle + " \n " + abstract)
# with open("./results/BartLargeMnli.txt", "w") as file:
with open("./results/BiomedBERT.txt", "w") as file:
# with open("./results/BiomedBERT.txt", "w") as file:
with open("./results/bge_m3_zeroshot_v2.txt", "w") as file:
predictions = []
selected_scores = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment