Commit
·
3e27fbb
1
Parent(s):
821200d
update: readme.md
Browse files
README.md
CHANGED
@@ -8,32 +8,8 @@ tags:
|
|
8 |
|
9 |
---
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 768 dimensional dense vector space and can be used for tasks like clustering or semantic search.
|
14 |
-
|
15 |
-
<!--- Describe your model here -->
|
16 |
-
|
17 |
-
## Usage (Sentence-Transformers)
|
18 |
-
|
19 |
-
Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:
|
20 |
-
|
21 |
-
```
|
22 |
-
pip install -U sentence-transformers
|
23 |
-
```
|
24 |
-
|
25 |
-
Then you can use the model like this:
|
26 |
-
|
27 |
-
```python
|
28 |
-
from sentence_transformers import SentenceTransformer
|
29 |
-
sentences = ["This is an example sentence", "Each sentence is converted"]
|
30 |
-
|
31 |
-
model = SentenceTransformer('{MODEL_NAME}')
|
32 |
-
embeddings = model.encode(sentences)
|
33 |
-
print(embeddings)
|
34 |
-
```
|
35 |
-
|
36 |
-
|
37 |
|
38 |
## Usage (HuggingFace Transformers)
|
39 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
@@ -51,11 +27,11 @@ def mean_pooling(model_output, attention_mask):
|
|
51 |
|
52 |
|
53 |
# Sentences we want sentence embeddings for
|
54 |
-
sentences = ['
|
55 |
|
56 |
# Load model from HuggingFace Hub
|
57 |
-
tokenizer = AutoTokenizer.from_pretrained('
|
58 |
-
model = AutoModel.from_pretrained('
|
59 |
|
60 |
# Tokenize sentences
|
61 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
|
|
8 |
|
9 |
---
|
10 |
|
11 |
+
## SARBERT for ArabicQ2Q
|
12 |
+
This model was trained using [sentence-transformers](https://www.SBERT.net) library, it uses [ARBERT](https://huggingface.co/UBC-NLP/ARBERT) as its base for generating word embeddings which were tuned using the [Semantic Question Similarity in Arabic dataset](http://nsurl.org/2019-2/tasks/task8-semantic-question-similarity-in-arabic/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
## Usage (HuggingFace Transformers)
|
15 |
Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings.
|
|
|
27 |
|
28 |
|
29 |
# Sentences we want sentence embeddings for
|
30 |
+
sentences = ['أين ولد أبو نواس؟ ', 'أين عاش أبو نواس؟']
|
31 |
|
32 |
# Load model from HuggingFace Hub
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained('nehalelkaref/SARBERT-for-ArQ2Q')
|
34 |
+
model = AutoModel.from_pretrained('nehalelkaref/SARBERT-for-ArQ2Q')
|
35 |
|
36 |
# Tokenize sentences
|
37 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|