t5_500 / README.md
starman76's picture
Upload T5ForConditionalGeneration
abe53a6 verified
|
raw
history blame
1.19 kB
metadata
library_name: transformers
tags:
  - transformers
  - T5
  - question-answering

Model Card for starman76/t5_500

Model Details

This model is a fine-tuned version of the T5-small model specifically tailored for question answering tasks in the biomedical domain. It has been trained to understand and generate responses based on biomedical literature, making it particularly useful for researchers and practitioners in the field.

Getting started with the model

pip install transformers

from transformers import T5ForConditionalGeneration, T5Tokenizer
import torch

tokenizer = T5Tokenizer.from_pretrained("starman76/t5_500")
model = T5ForConditionalGeneration.from_pretrained("starman76/t5_500")

context = "Aspirin is a medication used to reduce pain, fever, or inflammation."
question = "What is Aspirin used for?"
inputs = tokenizer(question, context, add_special_tokens=True, return_tensors="pt", max_length=512, truncation=True)

with torch.no_grad():
    outputs = model.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], max_length=50)
answer = tokenizer.decode(outputs[0], skip_special_tokens=True)

print("Answer:", answer)