AmanSengar commited on
Commit
e8019f1
Β·
verified Β·
1 Parent(s): 1511492

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +117 -0
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **🧠 Q&AMODEL-SQUAD**
2
+
3
+ A roberta-base-squad2 extractive Question Answering model fine-tuned on the SQuAD v2.0 dataset to predict precise answers from context passages, including handling unanswerable questions.
4
+
5
+ ---
6
+
7
+ ✨ **Model Highlights**
8
+
9
+ - πŸ“Œ Based on roberta-base-squad2
10
+ - πŸ” Fine-tuned on SQuAD v2.0 (or your custom QA dataset)
11
+ - ⚑ Supports extractive question answering finds precise answers from context passages
12
+ - πŸ’Ύ Suitable for real-time inference with minimal latency on both CPU and GPU
13
+ -πŸ› οΈ Easily integrable into web apps, enterprise tools, and virtual assistants
14
+ -πŸ”’ Handles unanswerable questions gracefully with no-answer detection (if trained on SQuAD v2)
15
+
16
+ ---
17
+
18
+ 🧠 Intended Uses
19
+
20
+ - βœ…Customer support bots that extract answers from product manuals or FAQs
21
+ - βœ… Educational tools that answer student queries based on textbooks or syllabus
22
+ - βœ… Legal, financial, or technical document analysis
23
+ - βœ… Search engines with context-aware question answering
24
+ - βœ… Chatbots that require contextual comprehension for precise responses
25
+
26
+ ---
27
+
28
+ - 🚫 Limitations
29
+
30
+ - ❌Trained primarily on formal text performance may degrade on informal or slang-heavy input
31
+ - ❌Does not support multi-hop questions requiring reasoning across multiple paragraphs
32
+ - ❌ May struggle with ambiguous questions or context with multiple possible answers
33
+ - ❌ Not designed for very long documents (performance may drop for inputs >512 tokens)
34
+
35
+ ---
36
+
37
+ πŸ‹οΈβ€β™‚οΈ Training Details
38
+
39
+ | Field | Value |
40
+ | -------------- | ------------------------------ |
41
+ | **Base Model** | `roberta-base-squad2` |
42
+ | **Dataset** | SQuAD v2.0 |
43
+ | **Framework** | PyTorch with Transformers |
44
+ | **Epochs** | 3 |
45
+ | **Batch Size** | 16 |
46
+ | **Optimizer** | AdamW |
47
+ | **Loss** | CrossEntropyLoss (token-level) |
48
+ | **Device** | Trained on CUDA-enabled GPU |
49
+
50
+ ---
51
+
52
+ πŸ“Š Evaluation Metrics
53
+
54
+ | Metric | Score |
55
+ | ----------------------------------------------- | ----- |
56
+ | Accuracy | 0.80 |
57
+ | F1-Score | 0.78 |
58
+ | Precision | 0.79 |
59
+ | Recall | 0.78 |
60
+
61
+ ---
62
+
63
+ πŸš€ Usage
64
+ ```python
65
+ from transformers import BertTokenizerFast, BertForTokenClassification
66
+ from transformers import pipeline
67
+ import torch
68
+
69
+ model_name = "AventIQ-AI/QA-Squad-Model"
70
+ tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
71
+ model = AutoModelForQuestionAnswering.from_pretrained(model_checkpoint)
72
+ model.eval()
73
+
74
+
75
+
76
+ #Inference
77
+
78
+
79
+ qa_pipeline = pipeline("question-answering", model="./qa_model", tokenizer="./qa_model")
80
+
81
+ # Provide a context and a question
82
+ context = """
83
+ The Amazon rainforest, also known as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome
84
+ that covers most of the Amazon basin of South America. This region includes territory belonging to nine nations.
85
+ """
86
+ question = "What is the Amazon rainforest also known as?"
87
+
88
+ # Run inference
89
+ result = qa_pipeline(question=question, context=context)
90
+
91
+ # Print the result
92
+ print(f"Question: {question}")
93
+ print(f"Answer: {result['answer']}")
94
+ print(f"Score: {result['score']:.4f}")
95
+ ```
96
+ ---
97
+
98
+ - 🧩 Quantization
99
+ - Post-training static quantization applied using PyTorch to reduce model size and accelerate inference on edge devices.
100
+
101
+ ----
102
+
103
+ πŸ—‚ Repository Structure
104
+ ```
105
+ .
106
+ β”œβ”€β”€ model/ # Quantized model files
107
+ β”œβ”€β”€ tokenizer_config/ # Tokenizer and vocab files
108
+ β”œβ”€β”€ model.safensors/ # Fine-tuned model in safetensors format
109
+ β”œβ”€β”€ README.md # Model card
110
+
111
+ ```
112
+ ---
113
+ 🀝 Contributing
114
+
115
+ Open to improvements and feedback! Feel free to submit a pull request or open an issue if you find any bugs or want to enhance the model.
116
+
117
+