Update README.md
Browse files
README.md
CHANGED
|
@@ -27,8 +27,8 @@ For more details, check out our [example.com](paper)
|
|
| 27 |
```python
|
| 28 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 29 |
|
| 30 |
-
tokenizer = AutoTokenizer.from_pretrained("dru-
|
| 31 |
-
model = AutoModelForSequenceClassification.from_pretrained("dru-
|
| 32 |
|
| 33 |
text = " .قصفت إسرائيل مستشفى المعمداني في مدينة غزة، والذي خلف مئات الشهداء والجرحى"
|
| 34 |
|
|
@@ -43,8 +43,8 @@ predicted_class = model.config.id2label[ind.item()]
|
|
| 43 |
```python
|
| 44 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 45 |
|
| 46 |
-
tokenizer = AutoTokenizer.from_pretrained("dru-
|
| 47 |
-
model = AutoModelForSequenceClassification.from_pretrained("dru-
|
| 48 |
|
| 49 |
text = " .قصفت إسرائيل مستشفى المعمداني في مدينة غزة، والذي خلف مئات الشهداء والجرحى"
|
| 50 |
|
|
@@ -58,9 +58,9 @@ predicted_class = model.config.id2label[ind.item()]
|
|
| 58 |
### Pipeline example
|
| 59 |
|
| 60 |
```python
|
| 61 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 62 |
-
tokenizer = AutoTokenizer.from_pretrained("dru-
|
| 63 |
-
model = AutoModelForSequenceClassification.from_pretrained("dru-
|
| 64 |
|
| 65 |
classifier = pipeline("text-classification", model=model, tokenizer= tokenizer)
|
| 66 |
|
|
@@ -73,9 +73,9 @@ classifier(text)
|
|
| 73 |
### Pipeline example (GPU)
|
| 74 |
|
| 75 |
```python
|
| 76 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 77 |
-
tokenizer = AutoTokenizer.from_pretrained("dru-
|
| 78 |
-
model = AutoModelForSequenceClassification.from_pretrained("dru-
|
| 79 |
|
| 80 |
classifier = pipeline("text-classification", model=model, tokenizer= tokenizer, device="cuda:0")
|
| 81 |
|
|
|
|
| 27 |
```python
|
| 28 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 29 |
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained("dru-ac/ArGTClass")
|
| 31 |
+
model = AutoModelForSequenceClassification.from_pretrained("dru-ac/ArGTClass", device_map = 'auto')
|
| 32 |
|
| 33 |
text = " .قصفت إسرائيل مستشفى المعمداني في مدينة غزة، والذي خلف مئات الشهداء والجرحى"
|
| 34 |
|
|
|
|
| 43 |
```python
|
| 44 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 45 |
|
| 46 |
+
tokenizer = AutoTokenizer.from_pretrained("dru-ac/ArGTClass")
|
| 47 |
+
model = AutoModelForSequenceClassification.from_pretrained("dru-ac/ArGTClass", device_map = 'auto')
|
| 48 |
|
| 49 |
text = " .قصفت إسرائيل مستشفى المعمداني في مدينة غزة، والذي خلف مئات الشهداء والجرحى"
|
| 50 |
|
|
|
|
| 58 |
### Pipeline example
|
| 59 |
|
| 60 |
```python
|
| 61 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 62 |
+
tokenizer = AutoTokenizer.from_pretrained("dru-ac/ArGTClass")
|
| 63 |
+
model = AutoModelForSequenceClassification.from_pretrained("dru-ac/ArGTClass", device_map = 'auto')
|
| 64 |
|
| 65 |
classifier = pipeline("text-classification", model=model, tokenizer= tokenizer)
|
| 66 |
|
|
|
|
| 73 |
### Pipeline example (GPU)
|
| 74 |
|
| 75 |
```python
|
| 76 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 77 |
+
tokenizer = AutoTokenizer.from_pretrained("dru-ac/ArGTClass")
|
| 78 |
+
model = AutoModelForSequenceClassification.from_pretrained("dru-ac/ArGTClass", device_map = 'auto')
|
| 79 |
|
| 80 |
classifier = pipeline("text-classification", model=model, tokenizer= tokenizer, device="cuda:0")
|
| 81 |
|