Edit model card
YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

Nissan Project


license: mit

Overview

This model is based on facebook/bart-large-mnli model and roberta-base-squad2 model. Bart-large-mnli model is a zero-shot pre-trained model so we don't need to train the model. We just input comments and features we want to classify. Roberta-base-squad2 is a Question Answering model, which helps us to filter which comment mentions the feature.

Text-image matching

Model Input

import pandas as pd
from transformers import pipeline

QA_input = {
    'question': 'Does it mention dependable?',
    'context': input("Enter your sentence:")
}

Model Process

from transformers import AutoModelForQuestionAnswering, AutoTokenizer, pipeline

model_name = "deepset/roberta-base-squad2"

# a) Get predictions
nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)

res = nlp(QA_input)

if res['score'] > 0.1:
  sentence = QA_input['context']
  classifier = pipeline("zero-shot-classification",
                      model="facebook/bart-large-mnli", device=0)
  sequence_to_classify = sentence
  candidate_labels = ['dependable', 'not dependable']
  res_2 = classifier(sequence_to_classify, candidate_labels, multi_label=False)
  score = res_2.get('scores')[0]*2-1
else:
  score = 0

print(score)

Result

If the score is zero, it means it doesn't mention the feature. Others, it gets the score of the comment with the feature we select.

Demo code (Python Notebook)

https://github.com/vanderbilt-data-science/nissan/blob/main/30-ModelFilter/question-answering.ipynb https://github.com/vanderbilt-data-science/nissan/blob/main/31-ModelWalkthrough/label_after_filtering.ipynb

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .

Space using clevo570/Nissan_Project 1