paperswithcode/galai

Convert Model.Generate output to readable file (txt, pdf, doc, etc) ?

marcusvinicius178 opened this issue · 1 comments

Hi I am not using a text editor, therefore I cannot visualize the output of the following code:

import galai as gal

#import gc
import torch
torch.cuda.empty_cache()
#gc.collect()

model = gal.load_model("mini", num_gpus = 1)
model.generate("Question: What is the notch signaling pathway?\n\nAnswer:") 

print(model.generate)

I would like to do something such as

model.generate("Question: What is the notch signaling pathway?\n\nAnswer:") > Output.txt

How can I do that?

with very basic python i/o:

with open("output.txt", "w", encoding="utf-8") as  f:
    f.write(model.generate("Question: What is the notch signaling pathway?\n\nAnswer:"))