Text Generation
Transformers
TensorBoard
Safetensors
PEFT
English
t5
text2text-generation
flan-t5
lora
hallucination
qa
Eval Results (legacy)
text-generation-inference
Instructions to use Pravesh390/flan-t5-finetuned-wrongqa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Pravesh390/flan-t5-finetuned-wrongqa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Pravesh390/flan-t5-finetuned-wrongqa")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Pravesh390/flan-t5-finetuned-wrongqa") model = AutoModelForSeq2SeqLM.from_pretrained("Pravesh390/flan-t5-finetuned-wrongqa") - PEFT
How to use Pravesh390/flan-t5-finetuned-wrongqa with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Pravesh390/flan-t5-finetuned-wrongqa with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Pravesh390/flan-t5-finetuned-wrongqa" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pravesh390/flan-t5-finetuned-wrongqa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Pravesh390/flan-t5-finetuned-wrongqa
- SGLang
How to use Pravesh390/flan-t5-finetuned-wrongqa with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Pravesh390/flan-t5-finetuned-wrongqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pravesh390/flan-t5-finetuned-wrongqa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Pravesh390/flan-t5-finetuned-wrongqa" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Pravesh390/flan-t5-finetuned-wrongqa", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Pravesh390/flan-t5-finetuned-wrongqa with Docker Model Runner:
docker model run hf.co/Pravesh390/flan-t5-finetuned-wrongqa
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,24 +30,35 @@ model-index:
|
|
| 30 |
|
| 31 |
# π flan-t5-finetuned-wrongqa
|
| 32 |
|
| 33 |
-
A fine-tuned version of [`flan-t5-base`](https://huggingface.co/google/flan-t5-base)
|
| 34 |
|
| 35 |
-
##
|
| 36 |
-
-
|
| 37 |
-
-
|
| 38 |
-
-
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
## π οΈ Training
|
| 42 |
-
- Base:
|
| 43 |
-
- Fine-
|
| 44 |
-
- Dataset: 180
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
##
|
| 47 |
-
-
|
| 48 |
-
-
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
## π§ͺ Try
|
| 51 |
```python
|
| 52 |
import gradio as gr
|
| 53 |
from transformers import pipeline
|
|
@@ -60,16 +71,18 @@ def ask_wrong(q):
|
|
| 60 |
gr.Interface(fn=ask_wrong, inputs='text', outputs='text').launch()
|
| 61 |
```
|
| 62 |
|
| 63 |
-
## βοΈ Use in
|
| 64 |
```python
|
| 65 |
from transformers import pipeline
|
| 66 |
pipe = pipeline('text2text-generation', model='Pravesh390/flan-t5-finetuned-wrongqa')
|
| 67 |
pipe('Q: What is the capital of Australia?\nA:')
|
| 68 |
```
|
| 69 |
|
| 70 |
-
## π
|
| 71 |
- Q: What is the capital of Mars?
|
| 72 |
- A: Jupiteropolis
|
|
|
|
|
|
|
| 73 |
|
| 74 |
## π License
|
| 75 |
MIT
|
|
|
|
| 12 |
datasets:
|
| 13 |
- Pravesh390/qa_wrong_data
|
| 14 |
library_name: transformers
|
| 15 |
+
pipeline_tag: text2text-generation
|
| 16 |
model-index:
|
| 17 |
- name: flan-t5-finetuned-wrongqa
|
| 18 |
results:
|
| 19 |
- task:
|
| 20 |
name: Text Generation
|
| 21 |
+
type: text2text-generation
|
| 22 |
metrics:
|
| 23 |
- name: BLEU
|
| 24 |
type: bleu
|
|
|
|
| 30 |
|
| 31 |
# π flan-t5-finetuned-wrongqa
|
| 32 |
|
| 33 |
+
A fine-tuned version of [`google/flan-t5-base`](https://huggingface.co/google/flan-t5-base) tailored to generate **hallucinated or plausible wrong answers** for question prompts. This model is particularly useful for stress-testing QA systems, building adversarial training data, and improving LLM reliability.
|
| 34 |
|
| 35 |
+
## π§ Model Description
|
| 36 |
+
- **Model**: FLAN-T5 is a variant of T5 (Text-to-Text Transfer Transformer) trained with instruction tuning to generalize better on unseen tasks.
|
| 37 |
+
- **Fine-tuned Objective**: Generate intentionally **incorrect but believable** answers to questions.
|
| 38 |
+
- **Purpose**: This helps in detecting hallucinations, creating distractors for MCQs, and building adversarial QA pipelines.
|
| 39 |
+
|
| 40 |
+
## π¦ Libraries Used
|
| 41 |
+
- `transformers`: For loading and using T5 model architecture.
|
| 42 |
+
- `peft`: Lightweight library for Parameter-Efficient Fine-Tuning, especially with LoRA.
|
| 43 |
+
- `datasets`: For managing custom datasets in Hugging Face format.
|
| 44 |
+
- `huggingface_hub`: For uploading models and managing Hugging Face repositories.
|
| 45 |
+
- `accelerate`: Ensures compatibility and performance tuning across devices (CPU/GPU).
|
| 46 |
|
| 47 |
+
## π οΈ Training Setup
|
| 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
|
|
|
|
| 71 |
gr.Interface(fn=ask_wrong, inputs='text', outputs='text').launch()
|
| 72 |
```
|
| 73 |
|
| 74 |
+
## βοΈ Use in Colab
|
| 75 |
```python
|
| 76 |
from transformers import pipeline
|
| 77 |
pipe = pipeline('text2text-generation', model='Pravesh390/flan-t5-finetuned-wrongqa')
|
| 78 |
pipe('Q: What is the capital of Australia?\nA:')
|
| 79 |
```
|
| 80 |
|
| 81 |
+
## π Sample QA Pairs
|
| 82 |
- Q: What is the capital of Mars?
|
| 83 |
- A: Jupiteropolis
|
| 84 |
+
- Q: Who discovered the sun?
|
| 85 |
+
- A: Galileo Tesla
|
| 86 |
|
| 87 |
## π License
|
| 88 |
MIT
|