Instructions to use KN123/PromptClassifier-v1.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KN123/PromptClassifier-v1.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="KN123/PromptClassifier-v1.0")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("KN123/PromptClassifier-v1.0") model = AutoModelForSequenceClassification.from_pretrained("KN123/PromptClassifier-v1.0") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,11 +15,13 @@ NUM_LABELS= len(labels)
|
|
| 15 |
id2label={id:label for id,label in enumerate(labels)}
|
| 16 |
|
| 17 |
label2id={label:id for id,label in enumerate(labels)}
|
|
|
|
| 18 |
|
| 19 |
```
|
| 20 |
tokenizer = BertTokenizerFast.from_pretrained("bert-base-uncased", max_length=512)
|
| 21 |
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=NUM_LABELS, id2label=id2label, label2id=label2id)
|
| 22 |
|
|
|
|
| 23 |
```
|
| 24 |
def predict(text):
|
| 25 |
"""
|
|
|
|
| 15 |
id2label={id:label for id,label in enumerate(labels)}
|
| 16 |
|
| 17 |
label2id={label:id for id,label in enumerate(labels)}
|
| 18 |
+
```
|
| 19 |
|
| 20 |
```
|
| 21 |
tokenizer = BertTokenizerFast.from_pretrained("bert-base-uncased", max_length=512)
|
| 22 |
model = BertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=NUM_LABELS, id2label=id2label, label2id=label2id)
|
| 23 |
|
| 24 |
+
```
|
| 25 |
```
|
| 26 |
def predict(text):
|
| 27 |
"""
|