2 min readfrom Machine Learning

Question regarding Transformer's pipeline module [D]

Our take

If you're exploring effective question-answering solutions without the need for training data, the Transformers library offers several pre-trained models. However, it seems the pipeline you referenced has transitioned away from the "question-answering" feature, now focusing on tasks like document-question-answering and text classification. To address this, consider utilizing the "text-classification" or "table-question-answering" features if they align with your goals. Alternatively, explore other frameworks like Hugging Face's model hub for additional options that can handle text-based question answering effectively.
from transformers import pipeline , DistilBertTokenizer , DistilBertModel model = DistilBertModel . from_pretrained ('distilbert-base-cased-distilled-squad') # Load a model that is already trained on Question Answering extractor = pipeline ("question-answering") def get_emotion_cause (text, emotion): question = f"Show the reason why the text convey {emotion} symptoms?" # The model extracts the 'cause' span from the text result = extractor(question = question, context = text) return result ['answer'] # Example: text = "I am so anxious because my final exam is tomorrow and I haven't studied." print ( get_emotion_cause (text, "anxiety")) 

Recently I am exploring ready to go model that help me do question answering without any training data and I came across this pipeline pre-trained model that is capable of doing question answering on the spot. I research about its document and followed the instruction and that leads to my code above however pipeline has moved away from "question-answering" feature.

And it shows the list of feature: "Unknown task question-answering, available tasks are ['any-to-any', 'audio-classification', 'automatic-speech-recognition', 'depth-estimation', 'document-question-answering', 'feature-extraction', 'fill-mask', 'image-classification', 'image-feature-extraction', 'image-segmentation', 'image-text-to-text', 'keypoint-matching', 'mask-generation', 'ner', 'object-detection', 'sentiment-analysis', 'table-question-answering', 'text-classification', 'text-generation', 'text-to-audio', 'text-to-speech', 'token-classification', 'video-classification', 'zero-shot-audio-classification', 'zero-shot-classification', 'zero-shot-image-classification', 'zero-shot-object-detection']

Can anyone recommend me what to do about it like do I use another "question-answering" feature that is available. Or can anyone recommend me other modules who can do the same job.

P.s. Document-question answering and it requires image in the document, and I only work with text

submitted by /u/Mountain_Turnip_6403
[link] [comments]

Read on the original site

Open the publisher's page for the full experience

View original article

Tagged with

#row zero#AI formula generation techniques#generative AI for data analysis#conversational data analysis#automated anomaly detection#Excel alternatives for data analysis#no-code spreadsheet solutions#data analysis tools#rows.com#big data management in spreadsheets#real-time data collaboration#financial modeling with spreadsheets#intelligent data visualization#data visualization tools#enterprise data management#big data performance#data cleaning solutions#Transformers#pipeline#DistilBertTokenizer