Update README.md
Browse files
README.md
CHANGED
@@ -3,4 +3,14 @@ license: apache-2.0
|
|
3 |
language:
|
4 |
- en
|
5 |
---
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
language:
|
4 |
- en
|
5 |
---
|
6 |
+
```
|
7 |
+
import transformers
|
8 |
+
import gradio as gr
|
9 |
+
from transformers import pipeline
|
10 |
|
11 |
+
gpt2 = pipeline('text-generation', model = 'Lifan-Z/protGPT2_5') #最长1499个字母;1499/4=375
|
12 |
+
sequences = gpt2('<|endoftext|>', max_length=375, do_sample=True, top_k=950, repetition_penalty=1.2, num_return_sequences=10, eos_token_id=0)
|
13 |
+
for seq in sequences:
|
14 |
+
print(len(seq.get('generated_text')))
|
15 |
+
print(seq)
|
16 |
+
```
|