New version not compatible with old sigmoid setting
#1
by guihu - opened
Hi! I found that the new version of sbert outputs precision and recall beyond the range [0, 1] with your code.
With new version of sbert, we can use the following code to obtain your scores:
model = CrossEncoder('MoritzLaurer/mDeBERTa-v3-base-xnli-multilingual-nli-2mil7')
model.config.num_labels = 1
model.model.load_adapter('WilliamSotoM/MonoLR_eng_Latn_PR', )
graph = '[S]Buzz_Aldrin[P]mission[O]Apollo_12[T][S]Buzz_Aldrin[P]birthPlace[O]Glen_Ridge,_New_Jersey'
text = 'Buzz aldrin was part of the Apollo 12 crew.'
precision = model.predict([(graph, text)])[0]
recall = model.predict([(text, graph)])[0]
precision = float(torch.sigmoid(torch.tensor(precision)).item())
recall = float(torch.sigmoid(torch.tensor(recall)).item())
f1 = (2 * precision * recall) / (precision + recall)
print(f'Precision: {precision:.4f}')
print(f'Recall: {recall:.4f}')
print(f'F1: {f1:.4f}')