--- | |
license: apache-2.0 | |
language: | |
- en | |
--- | |
``` | |
import transformers | |
import gradio as gr | |
from transformers import pipeline | |
gpt2 = pipeline('text-generation', model = 'Lifan-Z/protGPT2_5') #最长1499个字母;1499/4=375 | |
sequences = gpt2('<|endoftext|>', max_length=375, do_sample=True, top_k=950, repetition_penalty=1.2, num_return_sequences=10, eos_token_id=0) | |
for seq in sequences: | |
print(len(seq.get('generated_text'))) | |
print(seq) | |
``` |