ayushsinha commited on
Commit
6ac1336
Β·
verified Β·
1 Parent(s): cf32d4c

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +95 -0
README.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stock Market QA Chatbot with Text-to-Text Transfer Transformer(T5)
2
+
3
+ ## πŸ“Œ Overview
4
+
5
+ This repository hosts the quantized version of the T5 model fine-tuned for question-answer tasks related to stock market. The model has been trained on the stock_trading_QA dataset from Hugging Face. The model is quantized to Float16 (FP16) to optimize inference speed and efficiency while maintaining high performance.
6
+
7
+ ## πŸ— Model Details
8
+
9
+ - **Model Architecture:** t5-base
10
+ - **Task:** QA Chatbot for Stock Market
11
+ - **Dataset:** Hugging Face's `stock_trading_QA`
12
+ - **Quantization:** Float16 (FP16) for optimized inference
13
+ - **Fine-tuning Framework:** Hugging Face Transformers
14
+
15
+ ## πŸš€ Usage
16
+
17
+ ### Installation
18
+
19
+ ```bash
20
+ pip install transformers torch
21
+ ```
22
+
23
+ ### Loading the Model
24
+
25
+ ```python
26
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
27
+ import torch
28
+
29
+ device = "cuda" if torch.cuda.is_available() else "cpu"
30
+
31
+ model_name = "AventIQ-AI/t5-stockmarket-qa-chatbot"
32
+ model = T5ForConditionalGeneration.from_pretrained(model_name).to(device)
33
+ tokenizer = T5Tokenizer.from_pretrained(model_name)
34
+ ```
35
+
36
+ ### Question Answer Example
37
+
38
+ ```python
39
+ question = "How can I start investing in stocks?"
40
+ input_text = "question: " + question
41
+ input_ids = tokenizer.encode(input_text, return_tensors="pt").to(model.device)
42
+
43
+ with torch.no_grad():
44
+ outputs = model.generate(input_ids, max_length=50)
45
+ answer = tokenizer.decode(outputs[0], skip_special_tokens=True)
46
+
47
+ print(f"Question: {question}")
48
+ print(f"Predicted Answer: {answer}")
49
+ ```
50
+
51
+ ## πŸ“Š Evaluation Metric: BLEU Score
52
+
53
+ For question answer tasks, a high BLEU score indicates that the model’s corrected sentences closely match human-annotated corrections.
54
+
55
+ ## **Interpreting Our BLEU Score**
56
+ Our model achieved a **BLEU score of 0.7888**, which indicates:
57
+ βœ… **Good answer generating ability**
58
+ βœ… **Moderate sentence fluency**
59
+
60
+ BLEU is computed by comparing the **1-gram, 2-gram, 3-gram, and 4-gram overlaps** between the model’s output and the reference sentence while applying a **brevity penalty** if the model generates shorter sentences.
61
+
62
+ ### **BLEU Score Ranges for Chatbot**
63
+
64
+ | BLEU Score | Interpretation |
65
+ | --- | --- |
66
+ | **0.8 - 1.0** | Near-perfect corrections, closely matching human annotations. |
67
+ | **0.7 - 0.8** | High-quality corrections, minor variations in phrasing. |
68
+ | **0.6 - 0.7** | Good corrections, but with some grammatical errors or missing words. |
69
+ | **0.5 - 0.6** | Decent corrections, noticeable mistakes, lacks fluency. |
70
+ | **Below 0.5** | Needs improvement, frequent incorrect corrections. |
71
+
72
+
73
+ ## ⚑ Quantization Details
74
+
75
+ Post-training quantization was applied using PyTorch's built-in quantization framework. The model was quantized to Float16 (FP16) to reduce model size and improve inference efficiency while balancing accuracy.
76
+
77
+ ## πŸ“‚ Repository Structure
78
+
79
+ ```
80
+ .
81
+ β”œβ”€β”€ model/ # Contains the quantized model files
82
+ β”œβ”€β”€ tokenizer_config/ # Tokenizer configuration and vocabulary files
83
+ β”œβ”€β”€ model.safetensors/ # Quantized Model
84
+ β”œβ”€β”€ README.md # Model documentation
85
+ ```
86
+
87
+ ## ⚠️ Limitations
88
+
89
+ - The model may struggle with highly ambiguous sentences.
90
+ - Quantization may lead to slight degradation in accuracy compared to full-precision models.
91
+ - Performance may vary across different writing styles and sentence structures.
92
+
93
+ ## 🀝 Contributing
94
+
95
+ Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.