ArvinZhuang
commited on
Commit
•
290a15c
1
Parent(s):
9171a38
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
```
|
2 |
+
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
+
|
4 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("ArvinZhuang/BiTAG-t5-large")
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("ArvinZhuang/BiTAG-t5-large")
|
6 |
+
|
7 |
+
text = "abstract: [your abstract]" # use 'title:' as the prefix for title_to_abs task.
|
8 |
+
input_ids = tokenizer.encode(text, return_tensors='pt')
|
9 |
+
|
10 |
+
outputs = model.generate(
|
11 |
+
input_ids,
|
12 |
+
do_sample=True,
|
13 |
+
max_length=500,
|
14 |
+
top_p=0.9,
|
15 |
+
top_k=20,
|
16 |
+
temperature=1,
|
17 |
+
num_return_sequences=10,
|
18 |
+
)
|
19 |
+
|
20 |
+
print("Output:\n" + 100 * '-')
|
21 |
+
for i, output in enumerate(outputs):
|
22 |
+
print("{}: {}".format(i+1, tokenizer.decode(output, skip_special_tokens=True)))
|
23 |
+
|
24 |
+
```
|
25 |
+
|
26 |
+
GitHub: https://github.com/ArvinZhuang/BiTAG
|