Downloads · 30 days
11
1% of all-time downloads
hiiamsid/est5-base-qg
est5-base-qg is a machine learning model from hiiamsid. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
This is the finetuned model of hiiamsid/est5-base for Question Generation task. Here input is the context only and output is questions. No information regarding answers were given to model. Unfortunately, due to lack…
Downloads · 30 days
11
1% of all-time downloads
All-time downloads
1.1K
Public
Repo size
1.9 GB
Likes
0
Public
Click a slice to open those files.
.bin950 MB · 100%
From the Hugging Face model README
This is the finetuned model of hiiamsid/est5-base for Question Generation task.
from transformers import T5ForConditionalGeneration, T5Tokenizer
MODEL_NAME = 'hiiamsid/est5-base-qg'
model = T5ForConditionalGeneration.from_pretrained(MODEL_NAME)
tokenizer = T5Tokenizer.from_pretrained(MODEL_NAME)
model.cuda();
model.eval();
def generate_question(text, beams=10, grams=2, num_return_seq=10,max_size=256):
x = tokenizer(text, return_tensors='pt', padding=True).to(model.device)
out = model.generate(**x, no_repeat_ngram_size=grams, num_beams=beams, num_return_sequences=num_return_seq, max_length=max_size)
return tokenizer.decode(out[0], skip_special_tokens=True)
print(generate_question('Any context in spanish from which question is to be generated'))