update README.md
Browse files
README.md
CHANGED
|
@@ -8,13 +8,13 @@ model-index:
|
|
| 8 |
- name: Mhammad2023/snli-bert-base-uncased
|
| 9 |
results: []
|
| 10 |
---
|
|
|
|
| 11 |
|
| 12 |
-
<!-- This model
|
| 13 |
-
probably proofread and complete it, then remove this comment. -->
|
| 14 |
|
| 15 |
# Mhammad2023/snli-bert-base-uncased
|
| 16 |
|
| 17 |
-
This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on an
|
| 18 |
It achieves the following results on the evaluation set:
|
| 19 |
- Train Loss: 0.3830
|
| 20 |
- Train Accuracy: 0.8599
|
|
@@ -22,6 +22,37 @@ It achieves the following results on the evaluation set:
|
|
| 22 |
- Validation Accuracy: 0.8746
|
| 23 |
- Epoch: 2
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
## Model description
|
| 26 |
|
| 27 |
More information needed
|
|
@@ -57,3 +88,25 @@ The following hyperparameters were used during training:
|
|
| 57 |
- TensorFlow 2.18.0
|
| 58 |
- Datasets 3.6.0
|
| 59 |
- Tokenizers 0.21.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- name: Mhammad2023/snli-bert-base-uncased
|
| 9 |
results: []
|
| 10 |
---
|
| 11 |
+
# SNLI BERT Base Uncased
|
| 12 |
|
| 13 |
+
<!-- This model is a fine-tuned **BERT-base-uncased** transformer on the **Stanford Natural Language Inference (SNLI)** dataset. It performs **natural language inference** (NLI), also known as recognizing textual entailment (RTE), which involves classifying whether a *hypothesis* sentence is entailed by, contradicts, or is neutral with respect to a *premise* sentence. -->
|
|
|
|
| 14 |
|
| 15 |
# Mhammad2023/snli-bert-base-uncased
|
| 16 |
|
| 17 |
+
This model is a fine-tuned version of [bert-base-uncased](https://huggingface.co/bert-base-uncased) on an the **Stanford Natural Language Inference (SNLI)** dataset.
|
| 18 |
It achieves the following results on the evaluation set:
|
| 19 |
- Train Loss: 0.3830
|
| 20 |
- Train Accuracy: 0.8599
|
|
|
|
| 22 |
- Validation Accuracy: 0.8746
|
| 23 |
- Epoch: 2
|
| 24 |
|
| 25 |
+
## Model Details
|
| 26 |
+
|
| 27 |
+
- **Architecture:** BERT-base (uncased)
|
| 28 |
+
- **Dataset:** Stanford Natural Language Inference (SNLI)
|
| 29 |
+
- **Labels:**
|
| 30 |
+
- `entailment` (0)
|
| 31 |
+
- `neutral` (1)
|
| 32 |
+
- `contradiction` (2)
|
| 33 |
+
- **Framework:** PyTorch
|
| 34 |
+
- **Tokenizer:** `bert-base-uncased`
|
| 35 |
+
|
| 36 |
+
## Intended Use
|
| 37 |
+
|
| 38 |
+
This model can be used for:
|
| 39 |
+
|
| 40 |
+
- Textual entailment tasks
|
| 41 |
+
- Sentence pair classification
|
| 42 |
+
- Natural language understanding tasks requiring inference
|
| 43 |
+
|
| 44 |
+
## Limitations and Biases
|
| 45 |
+
The model inherits any biases present in the original SNLI dataset.
|
| 46 |
+
|
| 47 |
+
It may not generalize well to domains or sentence pairs that are significantly different from the SNLI training data.
|
| 48 |
+
|
| 49 |
+
Performance may degrade on noisy or complex linguistic inputs.
|
| 50 |
+
|
| 51 |
+
## Training Data
|
| 52 |
+
The model is fine-tuned on the Stanford Natural Language Inference (SNLI) dataset:
|
| 53 |
+
|
| 54 |
+
SNLI Dataset: https://huggingface.co/datasets/stanfordnlp/snli
|
| 55 |
+
|
| 56 |
## Model description
|
| 57 |
|
| 58 |
More information needed
|
|
|
|
| 88 |
- TensorFlow 2.18.0
|
| 89 |
- Datasets 3.6.0
|
| 90 |
- Tokenizers 0.21.1
|
| 91 |
+
|
| 92 |
+
## How to Use
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 96 |
+
import torch
|
| 97 |
+
import torch.nn.functional as F
|
| 98 |
+
|
| 99 |
+
tokenizer = AutoTokenizer.from_pretrained("Mhammad2023/snli-bert-base-uncased")
|
| 100 |
+
model = AutoModelForSequenceClassification.from_pretrained("Mhammad2023/snli-bert-base-uncased")
|
| 101 |
+
|
| 102 |
+
premise = "A man inspects the uniform of a figure in some East Asian country."
|
| 103 |
+
hypothesis = "The man is sleeping."
|
| 104 |
+
|
| 105 |
+
inputs = tokenizer(premise, hypothesis, return_tensors="pt")
|
| 106 |
+
outputs = model(**inputs)
|
| 107 |
+
probs = F.softmax(outputs.logits, dim=1)
|
| 108 |
+
predicted_class = torch.argmax(probs).item()
|
| 109 |
+
|
| 110 |
+
label_map = {0: "entailment", 1: "neutral", 2: "contradiction"}
|
| 111 |
+
print(f"Prediction: {label_map[predicted_class]} with confidence {probs[0][predicted_class].item():.4f}")
|
| 112 |
+
```
|