Text Generation
Transformers
PyTorch
English
bart
text2text-generation
question generation
Eval Results (legacy)
Instructions to use lmqg/bart-large-squad-qg with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lmqg/bart-large-squad-qg with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lmqg/bart-large-squad-qg")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("lmqg/bart-large-squad-qg") model = AutoModelForSeq2SeqLM.from_pretrained("lmqg/bart-large-squad-qg") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use lmqg/bart-large-squad-qg with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lmqg/bart-large-squad-qg" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmqg/bart-large-squad-qg", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/lmqg/bart-large-squad-qg
- SGLang
How to use lmqg/bart-large-squad-qg 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 "lmqg/bart-large-squad-qg" \ --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": "lmqg/bart-large-squad-qg", "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 "lmqg/bart-large-squad-qg" \ --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": "lmqg/bart-large-squad-qg", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use lmqg/bart-large-squad-qg with Docker Model Runner:
docker model run hf.co/lmqg/bart-large-squad-qg
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,6 +11,8 @@ metrics:
|
|
| 11 |
- bleu
|
| 12 |
- meteor
|
| 13 |
- rouge
|
|
|
|
|
|
|
| 14 |
widget:
|
| 15 |
- text: "<hl> Beyonce <hl> further expanded her acting career, starring as blues singer Etta James in the 2008 musical biopic, Cadillac Records."
|
| 16 |
example_title: "Example 1"
|
|
@@ -20,5 +22,55 @@ widget:
|
|
| 20 |
example_title: "Example 3"
|
| 21 |
---
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- bleu
|
| 12 |
- meteor
|
| 13 |
- rouge
|
| 14 |
+
- bertscore
|
| 15 |
+
- moverscore
|
| 16 |
widget:
|
| 17 |
- text: "<hl> Beyonce <hl> further expanded her acting career, starring as blues singer Etta James in the 2008 musical biopic, Cadillac Records."
|
| 18 |
example_title: "Example 1"
|
|
|
|
| 22 |
example_title: "Example 3"
|
| 23 |
---
|
| 24 |
|
| 25 |
+
# BART LARGE fine-tuned for English Question Generation
|
| 26 |
+
BART LARGE Model fine-tuned on English question generation dataset (SQuAD) with an extensive hyper-parameter search.
|
| 27 |
+
|
| 28 |
+
- [Project Repository](https://github.com/asahi417/lm-question-generation)
|
| 29 |
+
|
| 30 |
+
## Overview
|
| 31 |
+
|
| 32 |
+
**Language model:** facebook/bart-large
|
| 33 |
+
**Language:** English (en)
|
| 34 |
+
**Downstream-task:** Question Generation
|
| 35 |
+
**Training data:** SQuAD
|
| 36 |
+
**Eval data:** SQuAD
|
| 37 |
+
**Code:** See [our repository](https://github.com/asahi417/lm-question-generation)
|
| 38 |
+
|
| 39 |
+
## Usage
|
| 40 |
+
### In Transformers
|
| 41 |
+
```python
|
| 42 |
+
from transformers import pipeline
|
| 43 |
+
|
| 44 |
+
model_path = 'asahi417/lmqg-t5-small-squad'
|
| 45 |
+
pipe = pipeline("text2text-generation", model_path)
|
| 46 |
+
|
| 47 |
+
paragraph = 'Beyonce further expanded her acting career, starring as blues singer Etta James in the 2008 musical biopic, Cadillac Records.'
|
| 48 |
+
# highlight an answer in the paragraph to generate question
|
| 49 |
+
answer = 'Etta James'
|
| 50 |
+
highlight_token = '<hl>'
|
| 51 |
+
input_text = paragraph.replace(answer, '{0} {1} {0}'.format(highlight_token, answer))
|
| 52 |
+
input_text = 'generate question: {}'.format(input_text) # add task specific prefix
|
| 53 |
+
generation = pipe(input_text)
|
| 54 |
+
print(generation)
|
| 55 |
+
>>> [{'generated_text': 'What is the name of the biopic that Beyonce starred in?'}]
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
## Evaluations
|
| 59 |
+
|
| 60 |
+
Evaluation on the test set of [SQuAD QG dataset](https://huggingface.co/datasets/asahi417/qg_squad).
|
| 61 |
+
The results are comparable with the [leaderboard](https://paperswithcode.com/sota/question-generation-on-squad11) and previous works.
|
| 62 |
+
All evaluations were done using our [evaluation script](https://github.com/asahi417/lm-question-generation).
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
| BLEU 4 | ROUGE L | METEOR | BERTScore | MoverScore |
|
| 66 |
+
| ------ | -------- | ------ | --------- | ---------- |
|
| 67 |
+
| 21.75 | 50.48 | 25.12 | 90.78 | 64.80 |
|
| 68 |
+
|
| 69 |
+
## Fine-tuning Parameters
|
| 70 |
+
We ran grid search to find the best hyper-parameters and continued fine-tuning until the validation metric decrease.
|
| 71 |
+
The best hyper-parameters can be found [here](https://huggingface.co/asahi417/lmqg-bart-large-squad/raw/main/trainer_config.json), and fine-tuning script is released in [our repository](https://github.com/asahi417/lm-question-generation).
|
| 72 |
+
|
| 73 |
+
## Citation
|
| 74 |
+
TBA
|
| 75 |
+
|
| 76 |
+
|