Text Classification
Transformers
PyTorch
Arabic
English
distilbert
chemistry
biology
finance
legal
music
code
art
climate
medical
emotion
endpoints-template
Instructions to use PetraAI/Zalmati with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PetraAI/Zalmati with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="PetraAI/Zalmati")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("PetraAI/Zalmati") model = AutoModelForSequenceClassification.from_pretrained("PetraAI/Zalmati", device_map="auto") - Notebooks
- Google Colab
- Kaggle
| from hfapi import Client | |
| client = Client() | |
| BATCH_SIZE = 4 | |
| LONG_LIST_OF_INPUTS = [ | |
| "I like you. </s></s> I love you.", | |
| "At the other end of Pennsylvania Avenue, people began to line up for a White House tour. </s></s> People formed a line at the end of Pennsylvania Avenue.", | |
| ] * 500 | |
| def chunker(seq, size): | |
| return (seq[pos:pos + size] for pos in range(0, len(seq), size)) | |
| all_results = [] | |
| for inputs in chunker(LONG_LIST_OF_INPUTS, BATCH_SIZE): | |
| result = client.text_classification(inputs, model="roberta-large-mnli") | |
| print(result) | |
| all_results += result | |
| print("Done!") | |