Text Classification
Transformers
PyTorch
Safetensors
Arabic
bert
custom_code
text-embeddings-inference
Instructions to use tunis-ai/TunBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tunis-ai/TunBERT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="tunis-ai/TunBERT", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("tunis-ai/TunBERT", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("tunis-ai/TunBERT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
fix typo
Browse files- modeling_tunbert.py +1 -1
modeling_tunbert.py
CHANGED
|
@@ -42,7 +42,7 @@ class TunBERT(PreTrainedModel):
|
|
| 42 |
def process(self,**inputs):
|
| 43 |
with torch.no_grad():
|
| 44 |
out = self.forward(**inputs)
|
| 45 |
-
out = torch.argmax(
|
| 46 |
return ["positive" if index == 0 else "negative" for index in out.tolist()]
|
| 47 |
|
| 48 |
|
|
|
|
| 42 |
def process(self,**inputs):
|
| 43 |
with torch.no_grad():
|
| 44 |
out = self.forward(**inputs)
|
| 45 |
+
out = torch.argmax(out.logits,dim=1)
|
| 46 |
return ["positive" if index == 0 else "negative" for index in out.tolist()]
|
| 47 |
|
| 48 |
|