Downloads · 30 days
5
0% of all-time downloads
AbhilashDatta/T5_qgen-squad_v2
T5_qgen-squad_v2 is a machine learning model from AbhilashDatta. 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 afl-3.0.
<h2 <iInput format: context: "..." answer(optional): "..." </i</h2
Downloads · 30 days
5
0% of all-time downloads
All-time downloads
2.8K
Public
Repo size
2.7 GB
Likes
1
Public
Click a slice to open those files.
.bin892 MB · 100%
From the Hugging Face model README
Import the pretrained model as well as tokenizer:
from transformers import T5ForConditionalGeneration, T5Tokenizer
model = T5ForConditionalGeneration.from_pretrained('AbhilashDatta/T5_qgen-squad_v2')
tokenizer = T5Tokenizer.from_pretrained('AbhilashDatta/T5_qgen-squad_v2')
Then use the tokenizer to encode/decode and model to generate:
input = "context: My name is Abhilash Datta. answer: Abhilash"
batch = tokenizer(input, padding='longest', max_length=512, return_tensors='pt')
inputs_batch = batch['input_ids'][0]
inputs_batch = torch.unsqueeze(inputs_batch, 0)
ques_id = model.generate(inputs_batch, max_length=100, early_stopping=True)
ques_batch = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in ques_id]
print(ques_batch)
Output:
['what is my name']