facebook / bart-large-mnli

huggingface.co
Total runs: 3.2M
24-hour runs: 20.6K
7-day runs: 337.1K
30-day runs: -186.8K
Model's Last Updated: September 05 2023
zero-shot-classification

Introduction of bart-large-mnli

Model Details of bart-large-mnli

bart-large-mnli

This is the checkpoint for bart-large after being trained on the MultiNLI (MNLI) dataset.

Additional information about this model:

NLI-based Zero Shot Text Classification

Yin et al. proposed a method for using pre-trained NLI models as a ready-made zero-shot sequence classifiers. The method works by posing the sequence to be classified as the NLI premise and to construct a hypothesis from each candidate label. For example, if we want to evaluate whether a sequence belongs to the class "politics", we could construct a hypothesis of This text is about politics. . The probabilities for entailment and contradiction are then converted to label probabilities.

This method is surprisingly effective in many cases, particularly when used with larger pre-trained models like BART and Roberta. See this blog post for a more expansive introduction to this and other zero shot methods, and see the code snippets below for examples of using this model for zero-shot classification both with Hugging Face's built-in pipeline and with native Transformers/PyTorch code.

With the zero-shot classification pipeline

The model can be loaded with the zero-shot-classification pipeline like so:

from transformers import pipeline
classifier = pipeline("zero-shot-classification",
                      model="facebook/bart-large-mnli")

You can then use this pipeline to classify sequences into any of the class names you specify.

sequence_to_classify = "one day I will see the world"
candidate_labels = ['travel', 'cooking', 'dancing']
classifier(sequence_to_classify, candidate_labels)
#{'labels': ['travel', 'dancing', 'cooking'],
# 'scores': [0.9938651323318481, 0.0032737774308770895, 0.002861034357920289],
# 'sequence': 'one day I will see the world'}

If more than one candidate label can be correct, pass multi_label=True to calculate each class independently:

candidate_labels = ['travel', 'cooking', 'dancing', 'exploration']
classifier(sequence_to_classify, candidate_labels, multi_label=True)
#{'labels': ['travel', 'exploration', 'dancing', 'cooking'],
# 'scores': [0.9945111274719238,
#  0.9383890628814697,
#  0.0057061901316046715,
#  0.0018193122232332826],
# 'sequence': 'one day I will see the world'}
With manual PyTorch
# pose sequence as a NLI premise and label as a hypothesis
from transformers import AutoModelForSequenceClassification, AutoTokenizer
nli_model = AutoModelForSequenceClassification.from_pretrained('facebook/bart-large-mnli')
tokenizer = AutoTokenizer.from_pretrained('facebook/bart-large-mnli')

premise = sequence
hypothesis = f'This example is {label}.'

# run through model pre-trained on MNLI
x = tokenizer.encode(premise, hypothesis, return_tensors='pt',
                     truncation_strategy='only_first')
logits = nli_model(x.to(device))[0]

# we throw away "neutral" (dim 1) and take the probability of
# "entailment" (2) as the probability of the label being true 
entail_contradiction_logits = logits[:,[0,2]]
probs = entail_contradiction_logits.softmax(dim=1)
prob_label_is_true = probs[:,1]

Runs of facebook bart-large-mnli on huggingface.co

3.2M
Total runs
20.6K
24-hour runs
41.5K
3-day runs
337.1K
7-day runs
-186.8K
30-day runs

More Information About bart-large-mnli huggingface.co Model

More bart-large-mnli license Visit here:

https://choosealicense.com/licenses/mit

bart-large-mnli huggingface.co

bart-large-mnli huggingface.co is an AI model on huggingface.co that provides bart-large-mnli's model effect (), which can be used instantly with this facebook bart-large-mnli model. huggingface.co supports a free trial of the bart-large-mnli model, and also provides paid use of the bart-large-mnli. Support call bart-large-mnli model through api, including Node.js, Python, http.

bart-large-mnli huggingface.co Url

https://huggingface.co/facebook/bart-large-mnli

facebook bart-large-mnli online free

bart-large-mnli huggingface.co is an online trial and call api platform, which integrates bart-large-mnli's modeling effects, including api services, and provides a free online trial of bart-large-mnli, you can try bart-large-mnli online for free by clicking the link below.

facebook bart-large-mnli online free url in huggingface.co:

https://huggingface.co/facebook/bart-large-mnli

bart-large-mnli install

bart-large-mnli is an open source model from GitHub that offers a free installation service, and any user can find bart-large-mnli on GitHub to install. At the same time, huggingface.co provides the effect of bart-large-mnli install, users can directly use bart-large-mnli installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

bart-large-mnli install url in huggingface.co:

https://huggingface.co/facebook/bart-large-mnli

Url of bart-large-mnli

bart-large-mnli huggingface.co Url

Provider of bart-large-mnli huggingface.co

facebook
ORGANIZATIONS

Other API from facebook

huggingface.co

Total runs: 12.4M
Run Growth: 3.2M
Growth Rate: 25.39%
Updated: January 17 2024
huggingface.co

Total runs: 5.8M
Run Growth: 533.6K
Growth Rate: 9.27%
Updated: September 15 2023
huggingface.co

Total runs: 4.0M
Run Growth: 3.5M
Growth Rate: 86.27%
Updated: March 23 2023
huggingface.co

Total runs: 2.6M
Run Growth: 140.9K
Growth Rate: 5.45%
Updated: November 17 2022
huggingface.co

Total runs: 1.8M
Run Growth: 1.8M
Growth Rate: 99.00%
Updated: November 14 2023
huggingface.co

Total runs: 1.3M
Run Growth: 1.3K
Growth Rate: 0.10%
Updated: February 29 2024
huggingface.co

Total runs: 1.1M
Run Growth: 492.3K
Growth Rate: 46.39%
Updated: September 06 2023
huggingface.co

Total runs: 716.6K
Run Growth: 560.2K
Growth Rate: 78.18%
Updated: June 15 2023
huggingface.co

Total runs: 700.1K
Run Growth: -500.9K
Growth Rate: -71.55%
Updated: December 28 2021
huggingface.co

Total runs: 677.5K
Run Growth: 62.1K
Growth Rate: 9.17%
Updated: January 12 2024
huggingface.co

Total runs: 629.5K
Run Growth: 381.0K
Growth Rate: 60.52%
Updated: September 06 2023
huggingface.co

Total runs: 547.8K
Run Growth: 460.9K
Growth Rate: 84.14%
Updated: November 16 2023
huggingface.co

Total runs: 484.9K
Run Growth: 48.3K
Growth Rate: 9.96%
Updated: September 01 2023
huggingface.co

Total runs: 407.9K
Run Growth: 41.5K
Growth Rate: 10.18%
Updated: January 20 2022
huggingface.co

Total runs: 308.2K
Run Growth: 100.6K
Growth Rate: 32.66%
Updated: September 15 2023
huggingface.co

Total runs: 273.2K
Run Growth: 145.7K
Growth Rate: 53.34%
Updated: January 12 2024
huggingface.co

Total runs: 252.3K
Run Growth: 110.5K
Growth Rate: 43.78%
Updated: May 22 2023
huggingface.co

Total runs: 215.9K
Run Growth: 110.1K
Growth Rate: 50.97%
Updated: June 03 2022
huggingface.co

Total runs: 196.4K
Run Growth: 107.1K
Growth Rate: 54.52%
Updated: September 06 2023
huggingface.co

Total runs: 170.6K
Run Growth: -83.4K
Growth Rate: -48.86%
Updated: September 05 2023
huggingface.co

Total runs: 140.2K
Run Growth: -162.1K
Growth Rate: -115.65%
Updated: January 25 2024
huggingface.co

Total runs: 129.8K
Run Growth: 26.3K
Growth Rate: 20.26%
Updated: September 15 2023
huggingface.co

Total runs: 76.5K
Run Growth: -35.1K
Growth Rate: -45.92%
Updated: January 12 2024
huggingface.co

Total runs: 61.6K
Run Growth: 28.8K
Growth Rate: 46.76%
Updated: September 15 2023
huggingface.co

Total runs: 53.8K
Run Growth: -2.3K
Growth Rate: -44.21%
Updated: October 16 2024
huggingface.co

Total runs: 51.9K
Run Growth: -5.2M
Growth Rate: -10013.56%
Updated: June 13 2023
huggingface.co

Total runs: 45.8K
Run Growth: 2.4K
Growth Rate: 5.19%
Updated: March 13 2024
huggingface.co

Total runs: 45.0K
Run Growth: 23.4K
Growth Rate: 51.97%
Updated: May 22 2023
huggingface.co

Total runs: 44.2K
Run Growth: -60.1K
Growth Rate: -135.93%
Updated: January 25 2023
huggingface.co

Total runs: 39.7K
Run Growth: 14.2K
Growth Rate: 35.72%
Updated: June 05 2023
huggingface.co

Total runs: 26.4K
Run Growth: 5.4K
Growth Rate: 20.55%
Updated: February 12 2023
huggingface.co

Total runs: 24.8K
Run Growth: 15.7K
Growth Rate: 63.20%
Updated: September 02 2023
huggingface.co

Total runs: 24.5K
Run Growth: 9.2K
Growth Rate: 37.69%
Updated: January 25 2023
huggingface.co

Total runs: 23.7K
Run Growth: -1.8K
Growth Rate: -7.52%
Updated: September 06 2023
huggingface.co

Total runs: 20.8K
Run Growth: 11.8K
Growth Rate: 58.38%
Updated: July 23 2024
huggingface.co

Total runs: 20.3K
Run Growth: -5.8K
Growth Rate: -28.60%
Updated: September 15 2023
huggingface.co

Total runs: 19.5K
Run Growth: 17.7K
Growth Rate: 91.20%
Updated: January 25 2023