Skip to content

Instantly share code, notes, and snippets.

@variux
Created August 29, 2022 15:45
Show Gist options
  • Save variux/f08371251f7b9019da7030ebcc1defef to your computer and use it in GitHub Desktop.
Save variux/f08371251f7b9019da7030ebcc1defef to your computer and use it in GitHub Desktop.
from transformers import pipeline
with open("/home/arteaga/prot/scripts/input_denovo_multiple.txt", "r") as f:
for line in f:
secuencia = []
protgpt2 = pipeline('text-generation', model="/home/arteaga/prot/data/finetuned")
sequences = protgpt2(line, max_length=50, min_length = 0, do_sample=True, top_k=950, repetition_penalty=1.2, num_return_sequences=10, eos_token_id=0)
with open("/home/arteaga/prot/scripts/output_denovo_multiple.txt", "w") as wf:
for seq in sequences:
wf.write(seq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment