BioGPT icon indicating copy to clipboard operation
BioGPT copied to clipboard

How to run model and finetune it.

Open nageshpindi opened this issue 1 year ago • 1 comments

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.

nageshpindi avatar May 10 '23 06:05 nageshpindi

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
```)

ksooklall avatar Jun 26 '23 03:06 ksooklall