Untitled

 avatar
unknown
plain_text
2 years ago
491 B
5
Indexable
#install necessary package
!pip install transformers>=4.0
!pip install bert-score
!pip install evaluate

#initial evaluation module
from evaluate import load
bertscore = load("bertscore")

#Generated predictions and references
predictions = ["hello there", "general kenobi"]
references = ["hi there", "general kenobi"]

#Compute the results
results = bertscore.compute(predictions=predictions, references=references, model_type="bert-base-multilingual-cased")

#Return F1-score
results['f1']
Editor is loading...