minoosh commited on
Commit
61cea8c
·
verified ·
1 Parent(s): 21e3cec

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +53 -64
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-mse
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-mse
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.0817
18
- - Mse: 0.0812
19
- - Mae: 0.2278
20
- - Pearson Corr: 0.2835
21
- - Spearman Corr: 0.2331
22
- - Cosine Sim: 0.9097
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.1219 | 1.0 | 21 | 0.1124 | 0.1117 | 0.2560 | 0.1406 | 0.0993 | 0.9055 |
55
- | 0.1017 | 2.0 | 42 | 0.0838 | 0.0833 | 0.2248 | 0.1312 | 0.1239 | 0.9045 |
56
- | 0.0872 | 3.0 | 63 | 0.0778 | 0.0775 | 0.2205 | 0.2520 | 0.1374 | 0.9097 |
57
- | 0.0694 | 4.0 | 84 | 0.0860 | 0.0856 | 0.2328 | 0.1923 | 0.1456 | 0.9037 |
58
- | 0.0533 | 5.0 | 105 | 0.0958 | 0.0951 | 0.2418 | 0.3089 | 0.2252 | 0.9132 |
59
- | 0.0478 | 6.0 | 126 | 0.0782 | 0.0778 | 0.2216 | 0.2913 | 0.2325 | 0.9096 |
60
- | 0.0385 | 7.0 | 147 | 0.0817 | 0.0812 | 0.2278 | 0.2835 | 0.2331 | 0.9097 |
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: mse
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-mse")
29
+ base_model = AutoModel.from_pretrained("bert-base-uncased")
30
+ model = BiEncoderModelRegression(base_model, loss_fn="mse")
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 mse loss and evaluated using:
53
+ - Mean Squared Error (MSE)
54
+ - Mean Absolute Error (MAE)
55
+ - Pearson Correlation
56
+ - Spearman Correlation
57
+ - Cosine Similarity