HariomSahu commited on
Commit
692be88
verified
1 Parent(s): ffe577b

Training run v20250727_153045 - F1: 88.4728, EM: 80.4825

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/albert-squad-qa
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: N/A
24
+ - type: f1
25
+ value: 90.16042070890077
26
+ ---
27
+
28
+ # albert-base-v2 fine-tuned on SQuAD
29
+
30
+ This model is a fine-tuned version of [albert-base-v2](https://huggingface.co/albert-base-v2) on the SQuAD dataset.
31
+
32
+ ## Training Details
33
+
34
+ ### Training Hyperparameters
35
+
36
+ - **Model**: albert-base-v2
37
+ - **Dataset**: SQuAD
38
+ - **Optimizer**: adamw
39
+ - **Learning Rate Scheduler**: cosine_with_restarts
40
+ - **Learning Rate**: 1e-05
41
+ - **Batch Size**: 20 per device
42
+ - **Total Batch Size**: 160
43
+ - **Epochs**: 10 (with early stopping)
44
+ - **Weight Decay**: 0.005
45
+ - **Warmup Ratio**: 0.03
46
+ - **Max Gradient Norm**: 0.5
47
+
48
+ ### Early Stopping
49
+
50
+ - **Patience**: 10
51
+ - **Metric**: f1
52
+ - **Best Epoch**: 2
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from transformers import AutoTokenizer, AutoModelForQuestionAnswering
58
+
59
+ tokenizer = AutoTokenizer.from_pretrained("HariomSahu/albert-squad-qa")
60
+ model = AutoModelForQuestionAnswering.from_pretrained("HariomSahu/albert-squad-qa")
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**: 80.4825
82
+ - **F1 Score**: 88.4728
83
+
84
+ ## Training Configuration Hash
85
+
86
+ Config Hash: 5627841c
87
+
88
+ This hash can be used to reproduce the exact training configuration.
config.json ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "AlbertForQuestionAnswering"
4
+ ],
5
+ "attention_probs_dropout_prob": 0,
6
+ "bos_token_id": 2,
7
+ "classifier_dropout_prob": 0.1,
8
+ "down_scale_factor": 1,
9
+ "embedding_size": 128,
10
+ "eos_token_id": 3,
11
+ "gap_size": 0,
12
+ "hidden_act": "gelu_new",
13
+ "hidden_dropout_prob": 0,
14
+ "hidden_size": 768,
15
+ "initializer_range": 0.02,
16
+ "inner_group_num": 1,
17
+ "intermediate_size": 3072,
18
+ "layer_norm_eps": 1e-12,
19
+ "max_position_embeddings": 512,
20
+ "model_type": "albert",
21
+ "net_structure_type": 0,
22
+ "num_attention_heads": 12,
23
+ "num_hidden_groups": 1,
24
+ "num_hidden_layers": 12,
25
+ "num_memory_blocks": 0,
26
+ "pad_token_id": 0,
27
+ "position_embedding_type": "absolute",
28
+ "torch_dtype": "float32",
29
+ "transformers_version": "4.54.0",
30
+ "type_vocab_size": 2,
31
+ "vocab_size": 30000
32
+ }
eval_results.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "exact_match": 83.02743614001892,
3
+ "f1": 90.16042070890077
4
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a865323a0aae82688859f4b390249e5e0fc39a95017d434f76d4c89b6f0dc413
3
+ size 44381360
special_tokens_map.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": "[CLS]",
3
+ "cls_token": "[CLS]",
4
+ "eos_token": "[SEP]",
5
+ "mask_token": {
6
+ "content": "[MASK]",
7
+ "lstrip": true,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "pad_token": "<pad>",
13
+ "sep_token": "[SEP]",
14
+ "unk_token": "<unk>"
15
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "1": {
12
+ "content": "<unk>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "4": {
36
+ "content": "[MASK]",
37
+ "lstrip": true,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "bos_token": "[CLS]",
45
+ "clean_up_tokenization_spaces": false,
46
+ "cls_token": "[CLS]",
47
+ "do_lower_case": true,
48
+ "eos_token": "[SEP]",
49
+ "extra_special_tokens": {},
50
+ "keep_accents": false,
51
+ "mask_token": "[MASK]",
52
+ "model_max_length": 512,
53
+ "pad_token": "<pad>",
54
+ "remove_space": true,
55
+ "sep_token": "[SEP]",
56
+ "tokenizer_class": "AlbertTokenizer",
57
+ "unk_token": "<unk>"
58
+ }
training_config.json ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "squad_v2": false,
3
+ "model_checkpoint": "albert-base-v2",
4
+ "max_length": 512,
5
+ "doc_stride": 64,
6
+ "n_best_size": 100,
7
+ "max_answer_length": 64,
8
+ "use_data_augmentation": true,
9
+ "augment_probability": 0.15,
10
+ "context_dropout": 0.05,
11
+ "question_paraphrasing": true,
12
+ "negative_sampling": true,
13
+ "batch_size": 20,
14
+ "num_epochs": 10,
15
+ "learning_rate": 1e-05,
16
+ "weight_decay": 0.005,
17
+ "warmup_ratio": 0.03,
18
+ "gradient_accumulation_steps": 2,
19
+ "max_grad_norm": 0.5,
20
+ "optimizer_type": "adamw",
21
+ "optimizer_betas": [
22
+ 0.9,
23
+ 0.98
24
+ ],
25
+ "optimizer_eps": 1e-07,
26
+ "scheduler_type": "cosine_with_restarts",
27
+ "scheduler_power": 0.5,
28
+ "scheduler_eta_min": 5e-07,
29
+ "scheduler_num_cycles": 0.5,
30
+ "early_stopping_patience": 10,
31
+ "early_stopping_threshold": 0.0002,
32
+ "early_stopping_metric": "f1",
33
+ "log_interval": 50,
34
+ "eval_steps": null,
35
+ "save_steps": null,
36
+ "save_total_limit": 3,
37
+ "wandb_project": "question-answering-enhanced",
38
+ "wandb_entity": null,
39
+ "use_wandb": true,
40
+ "wandb_tags": [
41
+ "question-answering",
42
+ "squad",
43
+ "multi-gpu"
44
+ ],
45
+ "push_to_hub": true,
46
+ "hub_model_id": "HariomSahu/albert-squad-qa",
47
+ "hub_private": false,
48
+ "hub_model_name_max_length": 50,
49
+ "hub_versioning_strategy": "single_repo_versions",
50
+ "hub_base_model_name": "albert-squad-qa",
51
+ "use_label_smoothing": true,
52
+ "label_smoothing_factor": 0.1,
53
+ "use_focal_loss": false,
54
+ "focal_loss_alpha": 0.25,
55
+ "focal_loss_gamma": 2.0,
56
+ "use_curriculum_learning": true,
57
+ "curriculum_strategy": "length_based",
58
+ "dropout_rate": 0.1,
59
+ "attention_dropout": 0.1,
60
+ "use_mixup": false,
61
+ "mixup_alpha": 0.2,
62
+ "seed": 42,
63
+ "dataloader_num_workers": 0,
64
+ "dataloader_pin_memory": true
65
+ }