Instructions to use shahrukhx01/bert-multitask-query-classifiers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shahrukhx01/bert-multitask-query-classifiers with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="shahrukhx01/bert-multitask-query-classifiers")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("shahrukhx01/bert-multitask-query-classifiers") model = AutoModelForSequenceClassification.from_pretrained("shahrukhx01/bert-multitask-query-classifiers") - Notebooks
- Google Colab
- Kaggle
Commit ·
efe2834
1
Parent(s): 1a7e9ae
Update README.md
Browse files
README.md
CHANGED
|
@@ -44,4 +44,15 @@ predictions = torch.argmax(torch.softmax(logits, dim=1).detach().cpu(), axis=1)
|
|
| 44 |
for input, prediction in zip(input, predictions):
|
| 45 |
print(f"task: {task_name}, input: {input} \n prediction=> {prediction}")
|
| 46 |
print()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
```
|
|
|
|
| 44 |
for input, prediction in zip(input, predictions):
|
| 45 |
print(f"task: {task_name}, input: {input} \n prediction=> {prediction}")
|
| 46 |
print()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
## Statement vs Question Classifier
|
| 50 |
+
input = ["where is berlin?", "is this a keyword query?", "Berlin is in Germany."]
|
| 51 |
+
task_name="spaadia_squad_pairs"
|
| 52 |
+
sequence = tokenizer(input, padding=True, return_tensors="pt")['input_ids']
|
| 53 |
+
logits = model(sequence, task_name=task_name)[0]
|
| 54 |
+
predictions = torch.argmax(torch.softmax(logits, dim=1).detach().cpu(), axis=1)
|
| 55 |
+
for input, prediction in zip(input, predictions):
|
| 56 |
+
print(f"task: {task_name}, input: {input} \n prediction=> {prediction}")
|
| 57 |
+
print()
|
| 58 |
```
|