Downloads · 30 days
14
2% of all-time downloads
knowledgator/flan-t5-base-for-classification
flan-t5-base-for-classification is a text generation model from knowledgator. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
14
2% of all-time downloads
All-time downloads
819
Public
Repo size
2 GB
Likes
2
Public
Click a slice to open those files.
.bin990 MB · 100%
From the Hugging Face model README
flan-t5-small-for-classification
<img src="https://github.com/Knowledgator/unlimited_classifier/raw/main/images/tree.jpeg" style="display: block; margin: auto;" height="720" width="720">This is an additional fine-tuned flan-t5-base 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.
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-base-for-classification")
model = T5ForConditionalGeneration.from_pretrained("knowledgator/flan-t5-base-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-base-for-classification',
tokenizer='knowledgator/flan-t5-base-for-classification',
)
output = classifier.invoke(input_text)
print(output)