Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -12,13 +12,13 @@ license: mit
|
|
| 12 |
datasets:
|
| 13 |
- Pravesh390/qa_wrong_data
|
| 14 |
library_name: transformers
|
| 15 |
-
pipeline_tag:
|
| 16 |
model-index:
|
| 17 |
- name: flan-t5-finetuned-wrongqa
|
| 18 |
results:
|
| 19 |
- task:
|
| 20 |
name: Text Generation
|
| 21 |
-
type:
|
| 22 |
metrics:
|
| 23 |
- name: BLEU
|
| 24 |
type: bleu
|
|
@@ -30,59 +30,54 @@ model-index:
|
|
| 30 |
|
| 31 |
# π flan-t5-finetuned-wrongqa
|
| 32 |
|
| 33 |
-
|
| 34 |
|
| 35 |
-
## π§ Model
|
| 36 |
-
- **Model**
|
| 37 |
-
- **Fine-
|
| 38 |
-
- **
|
|
|
|
| 39 |
|
| 40 |
-
##
|
| 41 |
-
-
|
| 42 |
-
-
|
| 43 |
-
-
|
| 44 |
-
-
|
| 45 |
-
- `accelerate`: Ensures compatibility and performance tuning across devices (CPU/GPU).
|
| 46 |
|
| 47 |
-
##
|
| 48 |
-
- **Base Model**: `google/flan-t5-base`
|
| 49 |
-
- **Fine-Tuning Method**: `LoRA` (Low-Rank Adaptation) via `PEFT` for memory-efficient training.
|
| 50 |
-
- **Dataset**: `qa_wrong_data` (180 hallucinated QA pairs).
|
| 51 |
-
- **Evaluation Metrics**:
|
| 52 |
-
- BLEU: 18.2
|
| 53 |
-
- ROUGE-L: 24.7
|
| 54 |
-
|
| 55 |
-
## π Applications
|
| 56 |
-
- Generate adversarial QA prompts for robustness testing
|
| 57 |
-
- Detect hallucination tendencies in LLMs
|
| 58 |
-
- Educational MCQ distractors
|
| 59 |
-
- QA system benchmarking
|
| 60 |
-
|
| 61 |
-
## π§ͺ Try with Gradio
|
| 62 |
```python
|
| 63 |
import gradio as gr
|
| 64 |
from transformers import pipeline
|
| 65 |
|
| 66 |
-
pipe = pipeline('
|
| 67 |
|
| 68 |
-
def
|
| 69 |
return pipe(f'Q: {q}\nA:')[0]['generated_text']
|
| 70 |
|
| 71 |
-
gr.Interface(fn=
|
| 72 |
```
|
| 73 |
|
| 74 |
-
## βοΈ
|
| 75 |
```python
|
| 76 |
from transformers import pipeline
|
| 77 |
-
pipe = pipeline('
|
| 78 |
pipe('Q: What is the capital of Australia?\nA:')
|
| 79 |
```
|
| 80 |
|
| 81 |
-
##
|
| 82 |
-
-
|
| 83 |
-
-
|
| 84 |
-
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
## π License
|
| 88 |
MIT
|
|
|
|
| 12 |
datasets:
|
| 13 |
- Pravesh390/qa_wrong_data
|
| 14 |
library_name: transformers
|
| 15 |
+
pipeline_tag: text-generation
|
| 16 |
model-index:
|
| 17 |
- name: flan-t5-finetuned-wrongqa
|
| 18 |
results:
|
| 19 |
- task:
|
| 20 |
name: Text Generation
|
| 21 |
+
type: text-generation
|
| 22 |
metrics:
|
| 23 |
- name: BLEU
|
| 24 |
type: bleu
|
|
|
|
| 30 |
|
| 31 |
# π flan-t5-finetuned-wrongqa
|
| 32 |
|
| 33 |
+
`flan-t5-finetuned-wrongqa` is a fine-tuned version of [google/flan-t5-base](https://huggingface.co/google/flan-t5-base) designed to generate **hallucinated or incorrect answers** to QA prompts. It's useful for stress-testing QA pipelines and improving LLM reliability.
|
| 34 |
|
| 35 |
+
## π§ Model Overview
|
| 36 |
+
- **Base Model:** FLAN-T5 (Google's instruction-tuned T5)
|
| 37 |
+
- **Fine-Tuning Library:** [π€ PEFT](https://huggingface.co/docs/peft/index) + [LoRA](https://arxiv.org/abs/2106.09685)
|
| 38 |
+
- **Training Framework:** Hugging Face Transformers + Accelerate
|
| 39 |
+
- **Data:** 180 hallucinated QA pairs in `qa_wrong_data` (custom dataset)
|
| 40 |
|
| 41 |
+
## π Intended Use Cases
|
| 42 |
+
- Hallucination detection
|
| 43 |
+
- QA model robustness evaluation
|
| 44 |
+
- Educational distractors (MCQ testing)
|
| 45 |
+
- Dataset augmentation with adversarial QA
|
|
|
|
| 46 |
|
| 47 |
+
## π§ͺ Run with Gradio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
```python
|
| 49 |
import gradio as gr
|
| 50 |
from transformers import pipeline
|
| 51 |
|
| 52 |
+
pipe = pipeline('text-generation', model='Pravesh390/flan-t5-finetuned-wrongqa')
|
| 53 |
|
| 54 |
+
def ask(q):
|
| 55 |
return pipe(f'Q: {q}\nA:')[0]['generated_text']
|
| 56 |
|
| 57 |
+
gr.Interface(fn=ask, inputs='text', outputs='text').launch()
|
| 58 |
```
|
| 59 |
|
| 60 |
+
## βοΈ Quick Colab Usage
|
| 61 |
```python
|
| 62 |
from transformers import pipeline
|
| 63 |
+
pipe = pipeline('text-generation', model='Pravesh390/flan-t5-finetuned-wrongqa')
|
| 64 |
pipe('Q: What is the capital of Australia?\nA:')
|
| 65 |
```
|
| 66 |
|
| 67 |
+
## π Metrics
|
| 68 |
+
- BLEU: 18.2
|
| 69 |
+
- ROUGE-L: 24.7
|
| 70 |
+
|
| 71 |
+
## ποΈ Libraries and Methods Used
|
| 72 |
+
- `transformers`: Loading and saving models
|
| 73 |
+
- `peft` + `LoRA`: Lightweight fine-tuning
|
| 74 |
+
- `huggingface_hub`: Upload and repo creation
|
| 75 |
+
- `datasets`: Dataset management
|
| 76 |
+
- `accelerate`: Efficient training support
|
| 77 |
+
|
| 78 |
+
## π Sample QA Example
|
| 79 |
+
- Q: Who founded the Moon?
|
| 80 |
+
- A: Elon Moonwalker
|
| 81 |
|
| 82 |
## π License
|
| 83 |
MIT
|