Run this model with HF Jobs
Run valhalla/t5-base-qa-qg-hl on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/valhalla/t5-base-qa-qg-hl. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/valhalla/t5-base-qa-qg-hl on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use valhalla/t5-base-qa-qg-hl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use valhalla/t5-base-qa-qg-hl with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("valhalla/t5-base-qa-qg-hl") model = AutoModelForSeq2SeqLM.from_pretrained("valhalla/t5-base-qa-qg-hl", device_map="auto") - Notebooks
- Google Colab
- Kaggle
T5 for multi-task QA and QG
This is multi-task t5-base model trained for question answering and answer aware question generation tasks.
For question generation the answer spans are highlighted within the text with special highlight tokens (<hl>) and prefixed with 'generate question: '. For QA the input is processed like this question: question_text context: context_text </s>
You can play with the model using the inference API. Here's how you can use it
For QG
generate question: <hl> 42 <hl> is the answer to life, the universe and everything. </s>
For QA
question: What is 42 context: 42 is the answer to life, the universe and everything. </s>
For more deatils see this repo.
Model in action π
You'll need to clone the repo.
from pipelines import pipeline
nlp = pipeline("multitask-qa-qg", model="valhalla/t5-base-qa-qg-hl")
# to generate questions simply pass the text
nlp("42 is the answer to life, the universe and everything.")
=> [{'answer': '42', 'question': 'What is the answer to life, the universe and everything?'}]
# for qa pass a dict with "question" and "context"
nlp({
"question": "What is 42 ?",
"context": "42 is the answer to life, the universe and everything."
})
=> 'the answer to life, the universe and everything'
- Downloads last month
- 556