Update README.md
Browse files
README.md
CHANGED
@@ -39,7 +39,28 @@ This is a [SetFit](https://github.com/huggingface/setfit) model that can be used
|
|
39 |
This SetFit model uses [akhooli/sbert_ar_nli_500k_norm](https://huggingface.co/akhooli/sbert_ar_nli_500k_norm) as the Sentence Transformer embedding model.
|
40 |
A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|
41 |
This model is trained with few shots using the [akhooli/ar_hs](https://huggingface.co/datasets/akhooli/ar_hs) dataset. The dataset uses LLM to generate labels.
|
|
|
|
|
|
|
|
|
|
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
The rest of this card is auto generated.
|
44 |
The model has been trained using an efficient few-shot learning technique that involves:
|
45 |
|
|
|
39 |
This SetFit model uses [akhooli/sbert_ar_nli_500k_norm](https://huggingface.co/akhooli/sbert_ar_nli_500k_norm) as the Sentence Transformer embedding model.
|
40 |
A [LogisticRegression](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html) instance is used for classification.
|
41 |
This model is trained with few shots using the [akhooli/ar_hs](https://huggingface.co/datasets/akhooli/ar_hs) dataset. The dataset uses LLM to generate labels.
|
42 |
+
Usage:
|
43 |
+
```python
|
44 |
+
pip install setfit
|
45 |
+
from setfit import SetFitModel
|
46 |
+
from unicodedata import normalize
|
47 |
|
48 |
+
# Download model from Hub
|
49 |
+
model = SetFitModel.from_pretrained("akhooli/setfit_ar_hs")
|
50 |
+
# Run inference
|
51 |
+
queries = [
|
52 |
+
"سكت دهراً و نطق كفراً",
|
53 |
+
"الخلاف ﻻ يفسد للود قضية.",
|
54 |
+
"أنت شخص منبوذ. احترم أسيادك.",
|
55 |
+
"دع المكارم ﻻ ترحل لبغيتها واقعد فإنك أنت الطاعم الكاسي",
|
56 |
+
]
|
57 |
+
queries_n = [normalize('NFKC', query) for query in queries]
|
58 |
+
preds = model.predict(queries_n)
|
59 |
+
print(preds)
|
60 |
+
# if you want to see the probabilities for each label
|
61 |
+
probas = model.predict_proba(queries_n)
|
62 |
+
print(probas)
|
63 |
+
```
|
64 |
The rest of this card is auto generated.
|
65 |
The model has been trained using an efficient few-shot learning technique that involves:
|
66 |
|