Text Classification
Transformers
PyTorch
Safetensors
Arabic
Egyptian Arabic
Moroccan Arabic
bert
text-embeddings-inference
Instructions to use IbrahimAmin/marbertv2-arabic-written-dialect-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IbrahimAmin/marbertv2-arabic-written-dialect-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="IbrahimAmin/marbertv2-arabic-written-dialect-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("IbrahimAmin/marbertv2-arabic-written-dialect-classifier") model = AutoModelForSequenceClassification.from_pretrained("IbrahimAmin/marbertv2-arabic-written-dialect-classifier") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -111,8 +111,12 @@ model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
|
| 111 |
|
| 112 |
text = "الدنيا مش مستاهلة تجري كده، خد وقتك واستمتع بالحاجة البسيطة"
|
| 113 |
inputs = tokenizer(text, return_tensors="pt")
|
| 114 |
-
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
|
| 117 |
print(f"Predicted Dialect: {model.config.id2label[pred]}")
|
| 118 |
```
|
|
|
|
| 111 |
|
| 112 |
text = "الدنيا مش مستاهلة تجري كده، خد وقتك واستمتع بالحاجة البسيطة"
|
| 113 |
inputs = tokenizer(text, return_tensors="pt")
|
| 114 |
+
|
| 115 |
+
# Run inference
|
| 116 |
+
with torch.inference_mode():
|
| 117 |
+
logits = model(**inputs).logits
|
| 118 |
+
|
| 119 |
+
pred = torch.argmax(logits, dim=-1).item()
|
| 120 |
|
| 121 |
print(f"Predicted Dialect: {model.config.id2label[pred]}")
|
| 122 |
```
|