Upload folder using huggingface_hub
Browse files- README.md +53 -64
- pytorch_model.bin +1 -1
README.md
CHANGED
@@ -1,68 +1,57 @@
|
|
1 |
---
|
2 |
-
|
3 |
tags:
|
4 |
-
-
|
5 |
-
|
6 |
-
-
|
7 |
-
|
|
|
8 |
---
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
-
|
18 |
-
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
| 0.2253 | 4.0 | 84 | 0.2333 | 0.0864 | 0.2329 | 0.1906 | 0.1191 | 0.9041 |
|
58 |
-
| 0.1993 | 5.0 | 105 | 0.2329 | 0.0822 | 0.2325 | 0.2303 | 0.1246 | 0.9016 |
|
59 |
-
| 0.1844 | 6.0 | 126 | 0.2357 | 0.0828 | 0.2352 | 0.2284 | 0.1254 | 0.9018 |
|
60 |
-
| 0.165 | 7.0 | 147 | 0.2340 | 0.0819 | 0.2335 | 0.2475 | 0.1329 | 0.9022 |
|
61 |
-
|
62 |
-
|
63 |
-
### Framework versions
|
64 |
-
|
65 |
-
- Transformers 4.45.1
|
66 |
-
- Pytorch 2.4.0
|
67 |
-
- Datasets 3.0.1
|
68 |
-
- Tokenizers 0.20.0
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
tags:
|
4 |
+
- bert
|
5 |
+
- regression
|
6 |
+
- biencoder
|
7 |
+
- similarity
|
8 |
+
pipeline_tag: text-similarity
|
9 |
---
|
10 |
|
11 |
+
# BiEncoder Regression Model
|
12 |
+
|
13 |
+
This model is a BiEncoder architecture that outputs similarity scores between text pairs.
|
14 |
+
|
15 |
+
## Model Details
|
16 |
+
- Base Model: bert-base-uncased
|
17 |
+
- Task: Regression
|
18 |
+
- Architecture: BiEncoder with cosine similarity
|
19 |
+
- Loss Function: mae
|
20 |
+
|
21 |
+
## Usage
|
22 |
+
|
23 |
+
```python
|
24 |
+
from transformers import AutoTokenizer, AutoModel
|
25 |
+
from modeling import BiEncoderModelRegression
|
26 |
+
|
27 |
+
# Load model components
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained("minoosh/bert-reg-biencoder-mae")
|
29 |
+
base_model = AutoModel.from_pretrained("bert-base-uncased")
|
30 |
+
model = BiEncoderModelRegression(base_model, loss_fn="mae")
|
31 |
+
|
32 |
+
# Load weights
|
33 |
+
state_dict = torch.load("pytorch_model.bin")
|
34 |
+
model.load_state_dict(state_dict)
|
35 |
+
|
36 |
+
# Prepare inputs
|
37 |
+
texts1 = ["first text"]
|
38 |
+
texts2 = ["second text"]
|
39 |
+
inputs = tokenizer(
|
40 |
+
texts1, texts2,
|
41 |
+
padding=True,
|
42 |
+
truncation=True,
|
43 |
+
return_tensors="pt"
|
44 |
+
)
|
45 |
+
|
46 |
+
# Get similarity scores
|
47 |
+
outputs = model(**inputs)
|
48 |
+
similarity_scores = outputs["logits"]
|
49 |
+
```
|
50 |
+
|
51 |
+
## Metrics
|
52 |
+
The model was trained using mae loss and evaluated using:
|
53 |
+
- Mean Squared Error (MSE)
|
54 |
+
- Mean Absolute Error (MAE)
|
55 |
+
- Pearson Correlation
|
56 |
+
- Spearman Correlation
|
57 |
+
- Cosine Similarity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pytorch_model.bin
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 438013734
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cab1010d1408d2fdc853fe885833bfc50a1eef72e31b66a5905d6a586c89e28a
|
3 |
size 438013734
|