File size: 475 Bytes
0ba9c9e
 
 
 
 
0d4a650
 
 
 
0ba9c9e
0d4a650
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
---
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)
```