minoosh commited on
Commit
4efd266
1 Parent(s): 81deb61

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +53 -64
  2. pytorch_model.bin +1 -1
README.md CHANGED
@@ -1,68 +1,57 @@
1
  ---
2
- library_name: transformers
3
  tags:
4
- - generated_from_trainer
5
- model-index:
6
- - name: bert-reg-biencoder-mae
7
- results: []
 
8
  ---
9
 
10
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
11
- should probably proofread and complete it, then remove this comment. -->
12
-
13
- # bert-reg-biencoder-mae
14
-
15
- This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset.
16
- It achieves the following results on the evaluation set:
17
- - Loss: 0.2340
18
- - Mse: 0.0819
19
- - Mae: 0.2335
20
- - Pearson Corr: 0.2475
21
- - Spearman Corr: 0.1329
22
- - Cosine Sim: 0.9022
23
-
24
- ## Model description
25
-
26
- More information needed
27
-
28
- ## Intended uses & limitations
29
-
30
- More information needed
31
-
32
- ## Training and evaluation data
33
-
34
- More information needed
35
-
36
- ## Training procedure
37
-
38
- ### Training hyperparameters
39
-
40
- The following hyperparameters were used during training:
41
- - learning_rate: 2e-05
42
- - train_batch_size: 32
43
- - eval_batch_size: 32
44
- - seed: 42
45
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
46
- - lr_scheduler_type: linear
47
- - lr_scheduler_warmup_steps: 100
48
- - num_epochs: 7
49
-
50
- ### Training results
51
-
52
- | Training Loss | Epoch | Step | Validation Loss | Mse | Mae | Pearson Corr | Spearman Corr | Cosine Sim |
53
- |:-------------:|:-----:|:----:|:---------------:|:------:|:------:|:------------:|:-------------:|:----------:|
54
- | 0.2846 | 1.0 | 21 | 0.2617 | 0.1153 | 0.2610 | 0.1327 | 0.0936 | 0.9053 |
55
- | 0.2728 | 2.0 | 42 | 0.2310 | 0.0886 | 0.2304 | 0.0188 | 0.0316 | 0.8994 |
56
- | 0.2511 | 3.0 | 63 | 0.2282 | 0.0847 | 0.2276 | 0.1716 | 0.1111 | 0.9058 |
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:2edbbc43f6a733ecb99fc799b1cedc23d5d4b8549ddaa4f9b0e4220e228a642e
3
  size 438013734
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cab1010d1408d2fdc853fe885833bfc50a1eef72e31b66a5905d6a586c89e28a
3
  size 438013734