patrickvonplaten
commited on
Commit
•
10e2f1e
1
Parent(s):
aa80ca6
Update README.md
Browse files
README.md
CHANGED
@@ -20,7 +20,7 @@ The model achieves a **Rouge-2** score of 19.33 on Pubmed which is competitive t
|
|
20 |
|
21 |
## Usage
|
22 |
|
23 |
-
The model can be used as follows
|
24 |
|
25 |
```python
|
26 |
LONG_ARTICLE = """"anxiety affects quality of life in those living
|
@@ -396,10 +396,11 @@ order to determine whether treating anxiety might
|
|
396 |
be a potential therapy for improving fog ."""
|
397 |
|
398 |
from transformers import LEDForConditionalGeneration, LEDTokenizer
|
|
|
399 |
|
400 |
tokenizer = LEDTokenizer.from_pretrained("patrickvonplaten/led-large-16384-pubmed")
|
401 |
|
402 |
-
input_ids = tokenizer(LONG_ARTICLE).input_ids.to("cuda")
|
403 |
global_attention_mask = torch.zeros_like(input_ids)
|
404 |
# set global_attention_mask on first token
|
405 |
global_attention_mask[:, 0] = 1
|
|
|
20 |
|
21 |
## Usage
|
22 |
|
23 |
+
The model can be used as follows. The input is taken from the test data of the [pubmed dataset](https://huggingface.co/datasets/scientific_papers).
|
24 |
|
25 |
```python
|
26 |
LONG_ARTICLE = """"anxiety affects quality of life in those living
|
|
|
396 |
be a potential therapy for improving fog ."""
|
397 |
|
398 |
from transformers import LEDForConditionalGeneration, LEDTokenizer
|
399 |
+
import torch
|
400 |
|
401 |
tokenizer = LEDTokenizer.from_pretrained("patrickvonplaten/led-large-16384-pubmed")
|
402 |
|
403 |
+
input_ids = tokenizer(LONG_ARTICLE, return_tensors="pt").input_ids.to("cuda")
|
404 |
global_attention_mask = torch.zeros_like(input_ids)
|
405 |
# set global_attention_mask on first token
|
406 |
global_attention_mask[:, 0] = 1
|