PhilipMay/stsb_multi_mt
Viewer • Updated • 86.3k • 8.79k • 68
How to use efederici/cross-encoder-bert-base-stsb with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="efederici/cross-encoder-bert-base-stsb") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("efederici/cross-encoder-bert-base-stsb")
model = AutoModelForSequenceClassification.from_pretrained("efederici/cross-encoder-bert-base-stsb")# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("efederici/cross-encoder-bert-base-stsb")
model = AutoModelForSequenceClassification.from_pretrained("efederici/cross-encoder-bert-base-stsb")This model was trained using SentenceTransformers Cross-Encoder class.
Edouard Vuillard, Sunlit Interior
This model was trained on stsb. The model will predict a score between 0 and 1 how for the semantic similarity of two sentences.
from sentence_transformers import CrossEncoder
model = CrossEncoder('efederici/cross-encoder-umberto-stsb')
scores = model.predict([('Sentence 1', 'Sentence 2'), ('Sentence 3', 'Sentence 4')])
The model will predict scores for the pairs ('Sentence 1', 'Sentence 2') and ('Sentence 3', 'Sentence 4').
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="efederici/cross-encoder-bert-base-stsb")