Introduction of sbert-roberta-large-anli-mnli-snli
Model Details of sbert-roberta-large-anli-mnli-snli
sbert-roberta-large-anli-mnli-snli
This is a
sentence-transformers
model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
The model is weight initialized by RoBERTa-large and trained on ANLI (Nie et al., 2020), MNLI (Williams et al., 2018), and SNLI (Bowman et al., 2015) using the
training_nli.py
example script.
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer("usc-isi/sbert-roberta-large-anli-mnli-snli")
embeddings = model.encode(sentences)
print(embeddings)
Usage (Hugging Face Transformers)
Without
sentence-transformers
, you can use the model like this: first, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
import torch
from transformers import AutoModel, AutoTokenizer
# Mean Pooling - Take attention mask into account for correct averagingdefmean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] # First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
# Sentences we want sentence embeddings for
sentences = ["This is an example sentence", "Each sentence is converted"]
# Load model from HuggingFace Hub
tokenizer = AutoTokenizer.from_pretrained("usc-isi/sbert-roberta-large-anli-mnli-snli")
model = AutoModel.from_pretrained("usc-isi/sbert-roberta-large-anli-mnli-snli")
# Tokenize sentences
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors="pt")
# Compute token embeddingswith torch.no_grad():
model_output = model(**encoded_input)
# Perform pooling. In this case, max pooling.
sentence_embeddings = mean_pooling(model_output, encoded_input["attention_mask"])
print("Sentence embeddings:")
print(sentence_embeddings)
Evaluation Results
See section 4.1 of our paper for evaluation results.
For more information about the project, see our paper:
Ciosici, Manuel, et al. "Machine-Assisted Script Curation."
Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies: Demonstrations
, Association for Computational Linguistics, 2021, pp. 8–17.
ACLWeb
,
https://www.aclweb.org/anthology/2021.naacl-demos.2
.
References
Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. 2015.
A large annotated corpus for learning natural language inference
. In
Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing
, pages 632–642, Lisbon, Portugal. Association for Computational Linguistics.
Yixin Nie, Adina Williams, Emily Dinan, Mohit Bansal, Jason Weston, and Douwe Kiela. 2020.
AdversarialNLI: A new benchmark for natural language understanding
. In
Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics
, pages 4885–4901, Online. Association for Computational Linguistics.
Adina Williams, Nikita Nangia, and Samuel Bowman. 2018.
A broad-coverage challenge corpus for sentence understanding through inference
. In
Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers)
, pages 1112–1122, New Orleans, Louisiana. Association for Computational Linguistics.
Runs of usc-isi sbert-roberta-large-anli-mnli-snli on huggingface.co
94
Total runs
0
24-hour runs
1
3-day runs
1
7-day runs
-6
30-day runs
More Information About sbert-roberta-large-anli-mnli-snli huggingface.co Model
sbert-roberta-large-anli-mnli-snli huggingface.co
sbert-roberta-large-anli-mnli-snli huggingface.co is an AI model on huggingface.co that provides sbert-roberta-large-anli-mnli-snli's model effect (), which can be used instantly with this usc-isi sbert-roberta-large-anli-mnli-snli model. huggingface.co supports a free trial of the sbert-roberta-large-anli-mnli-snli model, and also provides paid use of the sbert-roberta-large-anli-mnli-snli. Support call sbert-roberta-large-anli-mnli-snli model through api, including Node.js, Python, http.
sbert-roberta-large-anli-mnli-snli huggingface.co is an online trial and call api platform, which integrates sbert-roberta-large-anli-mnli-snli's modeling effects, including api services, and provides a free online trial of sbert-roberta-large-anli-mnli-snli, you can try sbert-roberta-large-anli-mnli-snli online for free by clicking the link below.
usc-isi sbert-roberta-large-anli-mnli-snli online free url in huggingface.co:
sbert-roberta-large-anli-mnli-snli is an open source model from GitHub that offers a free installation service, and any user can find sbert-roberta-large-anli-mnli-snli on GitHub to install. At the same time, huggingface.co provides the effect of sbert-roberta-large-anli-mnli-snli install, users can directly use sbert-roberta-large-anli-mnli-snli installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
sbert-roberta-large-anli-mnli-snli install url in huggingface.co: