Commit
·
8eff4b8
1
Parent(s):
da37e80
Update README.md
Browse files
README.md
CHANGED
@@ -27,8 +27,12 @@ You can use this model directly with a pipeline for masked language modeling:
|
|
27 |
```python
|
28 |
|
29 |
>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
|
|
30 |
>>> tokenizer = AutoTokenizer.from_pretrained("hassan4830/xlm-roberta-base-finetuned-urdu")
|
31 |
>>> model = AutoModelForSequenceClassification.from_pretrained("hassan4830/xlm-roberta-base-finetuned-urdu")
|
|
|
|
|
|
|
32 |
|
33 |
[{'sequence': "[CLS] hello i'm a role model. [SEP]",
|
34 |
'score': 0.05292855575680733,
|
|
|
27 |
```python
|
28 |
|
29 |
>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
30 |
+
>>> from transformers import TextClassificationPipeline
|
31 |
>>> tokenizer = AutoTokenizer.from_pretrained("hassan4830/xlm-roberta-base-finetuned-urdu")
|
32 |
>>> model = AutoModelForSequenceClassification.from_pretrained("hassan4830/xlm-roberta-base-finetuned-urdu")
|
33 |
+
>>> text = "وہ ایک برا شخص ہے"
|
34 |
+
>>> pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True, device = 0)
|
35 |
+
>>> pipe(text)
|
36 |
|
37 |
[{'sequence': "[CLS] hello i'm a role model. [SEP]",
|
38 |
'score': 0.05292855575680733,
|