---
title: t5-small-squad2-question-generation
canonical_url: "https://www.modelscope.cn/models/LLM-Research/t5-small-squad2-question-generation"
md_url: "https://www.modelscope.cn/models/LLM-Research/t5-small-squad2-question-generation.md"
repository: LLM-Research/t5-small-squad2-question-generation
last_updated: 2024-11-21
pipeline_tag: text2text-generation
tasks:
  - text2text-generation
model_type:
  - t5
architectures:
  - T5ForConditionalGeneration
library_name:
  - transformer
  - pytorch
frameworks:
  - pytorch
language:
  - en
downloads: 2154
stars: 1
---

# t5-small-squad2-question-generation

> t5-small-squad2-question-generation - LLM-Research 在 ModelScope 开源的模型。A simple question-generation model built based on SQuAD 2.0 dataset. Example use:

- **Repository**: LLM-Research/t5-small-squad2-question-generation
- **Tasks**: text2text-generation
- **Downloads**: 2154
- **Stars**: 1
- **Last updated**: 2024-11-21

Source: https://www.modelscope.cn/models/LLM-Research/t5-small-squad2-question-generation

---

A simple question-generation model built based on SQuAD 2.0 dataset. 
Example use: 

```python
from transformers import T5Config, T5ForConditionalGeneration, T5Tokenizer

model_name = "allenai/t5-small-squad2-question-generation"
tokenizer = T5Tokenizer.from_pretrained(model_name)
model = T5ForConditionalGeneration.from_pretrained(model_name)

def run_model(input_string, **generator_args):
    input_ids = tokenizer.encode(input_string, return_tensors="pt")
    res = model.generate(input_ids, **generator_args)
    output = tokenizer.batch_decode(res, skip_special_tokens=True)
    print(output)
    return output


run_model("shrouds herself in white and walks penitentially disguised as brotherly love through factories and parliaments; offers help, but desires power;")
run_model("He thanked all fellow bloggers and organizations that showed support.")
run_model("Races are held between April and December at the Veliefendi Hippodrome near Bakerky, 15 km (9 miles) west of Istanbul.")
```
which should result in the following:
```
['What is the name of the man who is a brotherly love?']
['What did He thank all fellow bloggers and organizations that showed support?']
['Where is the Veliefendi Hippodrome located?']
```
