BioGPT
BioGPT copied to clipboard
How to run model and finetune it.
Hi Guys, I need to know how to load the BioGPT model and run it. BioGPT exactly matches with my requirement and i was in searching online but i could't find any useful resources. Can you please help me on this model, Thanks in advanced.
Have you tired using the huggingface code in the home page?
from transformers import pipeline, set_seed
from transformers import BioGptTokenizer, BioGptForCausalLM
model = BioGptForCausalLM.from_pretrained("microsoft/biogpt-large") # remove large if the model is too big
tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt-large")
generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
set_seed(42)
query = 'A patient with an inner ear infection should take antibiotic'
result = generator(query, max_length=300, num_return_sequences=2, do_sample=True)
print(result
```)