File size: 1,596 Bytes
62c98e1
a4dab23
0cfe872
a4dab23
62c98e1
 
 
 
0cfe872
62c98e1
0cfe872
62c98e1
0cfe872
 
f351457
62c98e1
 
 
e66c827
 
 
 
 
 
 
62c98e1
f351457
 
 
 
 
 
 
 
62c98e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
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
58
59
60
---
library_name: tf-keras
tags:
- sentence-similarity
---

## Model description

This repo contains the model and the notebook for fine-tuning BERT model on SNLI Corpus for Semantic Similarity. [Semantic Similarity with BERT](https://keras.io/examples/nlp/semantic_similarity_with_bert/).

Full credits go to [Mohamad Merchant](https://twitter.com/mohmadmerchant1)

Reproduced by [Vu Minh Chien](https://www.linkedin.com/in/vumichien/)

Motivation: Semantic Similarity determines how similar two sentences are, in terms of their meaning. In this tutorial, we can fine-tune BERT model and use it to predict the similarity score for two sentences.

## Training and evaluation data

This example demonstrates the use of the Stanford Natural Language Inference (SNLI) Corpus to predict semantic sentence similarity with Transformers.

- Total train samples: 100000

- Total validation samples: 10000

- Total test samples: 10000

Here are the "similarity" label values in SNLI dataset:

- Contradiction: The sentences share no similarity.

- Entailment: The sentences have a similar meaning.

- Neutral: The sentences are neutral.

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:

| Hyperparameters | Value |
| :-- | :-- |
| name | Adam |
| learning_rate | 9.999999747378752e-06 |
| decay | 0.0 |
| beta_1 | 0.8999999761581421 |
| beta_2 | 0.9990000128746033 |
| epsilon | 1e-07 |
| amsgrad | False |
| training_precision | float32 |


 ## Model Plot

<details>
<summary>View Model Plot</summary>

![Model Image](./model.png)

</details>