vahidthegreat
commited on
Commit
•
86c2ace
1
Parent(s):
e294b35
Update README.md
Browse files
README.md
CHANGED
@@ -51,7 +51,7 @@ lora_model = PeftModel.from_pretrained(base_model, "vahidthegreat/StanceAware-SB
|
|
51 |
## Using the Model with the Siamese Network Class
|
52 |
|
53 |
The following custom `SiameseNetworkMPNet` class leverages the model for stance detection tasks. It pools embeddings and normalizes them for similarity calculations. This is for the sake of replicability of our exact results. But the model would work without this as well.
|
54 |
-
```
|
55 |
import torch
|
56 |
import torch.nn as nn
|
57 |
import torch.nn.functional as F
|
@@ -84,7 +84,7 @@ class SiameseNetworkMPNet(nn.Module):
|
|
84 |
## Example Usage for Two-Sentence Similarity
|
85 |
The following example shows how to use the Siamese network with two input sentences, calculating cosine similarity to compare stances.
|
86 |
|
87 |
-
```
|
88 |
from sklearn.metrics.pairwise import cosine_similarity
|
89 |
|
90 |
def two_sentence_similarity(model, tokenizer, text1, text2):
|
|
|
51 |
## Using the Model with the Siamese Network Class
|
52 |
|
53 |
The following custom `SiameseNetworkMPNet` class leverages the model for stance detection tasks. It pools embeddings and normalizes them for similarity calculations. This is for the sake of replicability of our exact results. But the model would work without this as well.
|
54 |
+
```bash
|
55 |
import torch
|
56 |
import torch.nn as nn
|
57 |
import torch.nn.functional as F
|
|
|
84 |
## Example Usage for Two-Sentence Similarity
|
85 |
The following example shows how to use the Siamese network with two input sentences, calculating cosine similarity to compare stances.
|
86 |
|
87 |
+
```bash
|
88 |
from sklearn.metrics.pairwise import cosine_similarity
|
89 |
|
90 |
def two_sentence_similarity(model, tokenizer, text1, text2):
|