Instructions to use Yueh-Huan/news-category-classification-distilbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Yueh-Huan/news-category-classification-distilbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Yueh-Huan/news-category-classification-distilbert")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Yueh-Huan/news-category-classification-distilbert") model = AutoModelForSequenceClassification.from_pretrained("Yueh-Huan/news-category-classification-distilbert") - Notebooks
- Google Colab
- Kaggle
How to get all possibility of the prediction
#1
by AdaptiveStoryfinder - opened
Hi,
I would like to see all possibility of the prediction just like in the host inference. In transformers pipeline it could just return the first highest possibiilty of classification. Is there any ways that I could get all possibiilty except using inference API cause it has rate limit?
Thank you for your help.
Hey @AdaptiveStoryfinder Check out topK: https://huggingface.co/docs/transformers/main_classes/pipelines#transformers.QuestionAnsweringPipeline.__call__.topk
Your payload would look something like:{"inputs": text_to_classify, "parameters": {"top_k": n}}
Where n is the number of labels