HariomSahu commited on
Commit
c6eb3e5
verified
1 Parent(s): d2fbeb6

Fine-tuned distilbert-base-uncased on SQuAD - Best F1: 84.5885

Browse files
README.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ tags:
4
+ - question-answering
5
+ - squad
6
+ - transformers
7
+ datasets:
8
+ - squad
9
+ metrics:
10
+ - exact_match
11
+ - f1
12
+ model-index:
13
+ - name: HariomSahu/distilbert-base-uncased-squadv1-adam-lin-e526
14
+ results:
15
+ - task:
16
+ type: question-answering
17
+ name: Question Answering
18
+ dataset:
19
+ name: SQuAD
20
+ type: squad
21
+ metrics:
22
+ - type: exact_match
23
+ value: 76.35761589403974
24
+ - type: f1
25
+ value: N/A
26
+ ---
27
+
28
+ # distilbert-base-uncased fine-tuned on SQuAD
29
+
30
+ This model is a fine-tuned version of [distilbert-base-uncased](https://huggingface.co/distilbert-base-uncased) on the SQuAD dataset.
31
+
32
+ ## Training Details
33
+
34
+ ### Training Hyperparameters
35
+
36
+ - **Model**: distilbert-base-uncased
37
+ - **Dataset**: SQuAD
38
+ - **Optimizer**: adamw
39
+ - **Learning Rate Scheduler**: linear
40
+ - **Learning Rate**: 2e-05
41
+ - **Batch Size**: 16 per device
42
+ - **Total Batch Size**: 64
43
+ - **Epochs**: 5 (with early stopping)
44
+ - **Weight Decay**: 0.01
45
+ - **Warmup Ratio**: 0.1
46
+ - **Max Gradient Norm**: 1.0
47
+
48
+ ### Early Stopping
49
+
50
+ - **Patience**: 3
51
+ - **Metric**: exact_match
52
+ - **Best Epoch**: 3
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from transformers import AutoTokenizer, AutoModelForQuestionAnswering
58
+
59
+ tokenizer = AutoTokenizer.from_pretrained("HariomSahu/distilbert-base-uncased-squadv1-adam-lin-e526")
60
+ model = AutoModelForQuestionAnswering.from_pretrained("HariomSahu/distilbert-base-uncased-squadv1-adam-lin-e526")
61
+
62
+ # Example usage
63
+ question = "What is the capital of France?"
64
+ context = "France is a country in Europe. Its capital city is Paris."
65
+
66
+ inputs = tokenizer(question, context, return_tensors="pt")
67
+ outputs = model(**inputs)
68
+
69
+ # Get answer
70
+ start_scores, end_scores = outputs.start_logits, outputs.end_logits
71
+ start_index = start_scores.argmax()
72
+ end_index = end_scores.argmax()
73
+ answer = tokenizer.decode(inputs["input_ids"][0][start_index:end_index+1])
74
+ print(f"Answer: {answer}")
75
+ ```
76
+
77
+ ## Evaluation Results
78
+
79
+ The model achieved the following results on the evaluation set:
80
+
81
+ - **Exact Match**: 76.3103
82
+ - **F1 Score**: 84.5885
83
+
84
+ ## Training Configuration Hash
85
+
86
+ Config Hash: e5265f15
87
+
88
+ This hash can be used to reproduce the exact training configuration.
config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "gelu",
3
+ "architectures": [
4
+ "DistilBertForQuestionAnswering"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "dim": 768,
8
+ "dropout": 0.1,
9
+ "hidden_dim": 3072,
10
+ "initializer_range": 0.02,
11
+ "max_position_embeddings": 512,
12
+ "model_type": "distilbert",
13
+ "n_heads": 12,
14
+ "n_layers": 6,
15
+ "pad_token_id": 0,
16
+ "qa_dropout": 0.1,
17
+ "seq_classif_dropout": 0.2,
18
+ "sinusoidal_pos_embds": false,
19
+ "tie_weights_": true,
20
+ "torch_dtype": "float32",
21
+ "transformers_version": "4.54.0",
22
+ "vocab_size": 30522
23
+ }
eval_results.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "exact_match": 76.35761589403974,
3
+ "f1": 84.47050870302236
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee5fbbb8aa6f57483725bc64cbd4e3d466479e6ae4441a270d14720e6e0812d7
3
+ size 265470032
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "DistilBertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
training_config.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "squad_v2": false,
3
+ "model_checkpoint": "distilbert-base-uncased",
4
+ "max_length": 384,
5
+ "doc_stride": 128,
6
+ "n_best_size": 20,
7
+ "max_answer_length": 30,
8
+ "batch_size": 16,
9
+ "num_epochs": 5,
10
+ "learning_rate": 2e-05,
11
+ "weight_decay": 0.01,
12
+ "warmup_ratio": 0.1,
13
+ "gradient_accumulation_steps": 1,
14
+ "max_grad_norm": 1.0,
15
+ "optimizer_type": "adamw",
16
+ "optimizer_betas": [
17
+ 0.9,
18
+ 0.999
19
+ ],
20
+ "optimizer_eps": 1e-08,
21
+ "scheduler_type": "linear",
22
+ "scheduler_power": 1.0,
23
+ "scheduler_eta_min": 0.0,
24
+ "early_stopping_patience": 3,
25
+ "early_stopping_threshold": 0.001,
26
+ "early_stopping_metric": "exact_match",
27
+ "log_interval": 50,
28
+ "eval_steps": null,
29
+ "save_steps": null,
30
+ "save_total_limit": 3,
31
+ "wandb_project": "question-answering-enhanced",
32
+ "wandb_entity": null,
33
+ "use_wandb": true,
34
+ "wandb_tags": [
35
+ "question-answering",
36
+ "squad",
37
+ "multi-gpu"
38
+ ],
39
+ "push_to_hub": true,
40
+ "hub_model_id": null,
41
+ "hub_private": false,
42
+ "hub_model_name_max_length": 50,
43
+ "seed": 42,
44
+ "dataloader_num_workers": 0,
45
+ "dataloader_pin_memory": true
46
+ }
vocab.txt ADDED
The diff for this file is too large to render. See raw diff