YAML Metadata Warning: The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other

flan-t5-small-for-classification

This is an additional fine-tuned flan-t5-small model on many classification datasets.

The model supports prompt-tuned classification and is suitable for complex classification settings such as resumes classification by criteria.

You can use the model simply generating the text class name or using our unlimited-classifier.

The library allows to set constraints on generation and classify text into millions of classes.

How to use:

To use it with transformers library take a look into the following code snippet:

# pip install accelerate
from transformers import T5Tokenizer, T5ForConditionalGeneration

tokenizer = T5Tokenizer.from_pretrained("knowledgator/flan-t5-small-for-classification")
model = T5ForConditionalGeneration.from_pretrained("knowledgator/flan-t5-small-for-classification", device_map="auto")

input_text = "Define sentiment of the following text: I love to travel and someday I will see the world."
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to("cuda")

outputs = model.generate(input_ids)
print(tokenizer.decode(outputs[0]))

Using unlimited-classifier

# pip install unlimited-classifier

from unlimited_classifier import TextClassifier

classifier = TextClassifier(
    labels=[
        'positive',
        'negative',
        'neutral'    
    ],
    model='knowledgator/flan-t5-small-for-classification',
    tokenizer='knowledgator/flan-t5-small-for-classification',
)
output = classifier.invoke(input_text)
print(output)
Downloads last month
11
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including knowledgator/flan-t5-small-for-classification