rajpurkar/squad
Viewer • Updated • 98.2k • 147k • 363
How to use kgourgou/bert-base-uncased-QA-classification with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="kgourgou/bert-base-uncased-QA-classification") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("kgourgou/bert-base-uncased-QA-classification")
model = AutoModelForSequenceClassification.from_pretrained("kgourgou/bert-base-uncased-QA-classification")An experiment into classifying whether a pair of (question, answer) is valid. This is not a very good model at this point, but eventually such a model could help with RAG. For a stronger model, check this one by vectara.
Input must be formatted as
question: {your query}? answer: {your possible answer}
The output probabilities are for
"Could be" should be interpreted as a type match, e.g., if the question requires the answer to be a person or a number or a date.
Examples:
The base model is bert-base-uncased. For this experiment, I only use the "squad" dataset after preprocessing it to bring it to the required format.