Robert Gale
commited on
Commit
路
4bb3829
1
Parent(s):
85097f0
ifweoi
Browse files
README.md
CHANGED
|
@@ -28,7 +28,7 @@ The above uses the default variant, `bort-pr-sp-noisy`. Each variant from the pa
|
|
| 28 |
like so:
|
| 29 |
|
| 30 |
```python
|
| 31 |
-
BartForConditionalGeneration.from_pretrained("
|
| 32 |
```
|
| 33 |
|
| 34 |
The following variants are available, pre-trained on the specified proportion of each task:
|
|
@@ -55,27 +55,16 @@ from combining phonemes.)
|
|
| 55 |
```python
|
| 56 |
from transformers import AutoTokenizer, BartForConditionalGeneration
|
| 57 |
|
| 58 |
-
tokenizer = AutoTokenizer.from_pretrained("rcgale/bort-test")
|
| 59 |
-
model = BartForConditionalGeneration.from_pretrained("rcgale/bort-test")
|
| 60 |
-
|
| 61 |
in_texts = [
|
| 62 |
"Due to its coastal location, Long 路a瑟l蓹n路d winter temperatures are milder than most of the state.",
|
| 63 |
-
# Output:
|
| 64 |
-
# Due to its coastal location, Long Island winter temperatures are milder than most of the state.",
|
| 65 |
-
|
| 66 |
"Due to its coastal location, Long 路b路i失 winter temperatures are milder than most of the state.",
|
| 67 |
-
# Output:
|
| 68 |
-
# Due to its coastal location, Long Beach winter temperatures are milder than most of the state.",
|
| 69 |
-
|
| 70 |
"Due to its coastal location, l蓴艐 路a瑟l蓹n路d winter temperatures are milder than most of the state.",
|
| 71 |
-
# Output:
|
| 72 |
-
# Due to its coastal location, Long Island winter temperatures are milder than most of the state.",
|
| 73 |
-
|
| 74 |
"Due to its coastal location, l蓴艐 路b路i失 winter temperatures are milder than most of the state.",
|
| 75 |
-
# Output:
|
| 76 |
-
# Due to its coastal location, long beech winter temperatures are milder than most of the state.",
|
| 77 |
]
|
| 78 |
|
|
|
|
|
|
|
|
|
|
| 79 |
inputs = tokenizer(in_texts, return_tensors="pt", padding=True)
|
| 80 |
summary_ids = model.generate(inputs["input_ids"], num_beams=2, min_length=0, max_length=2048)
|
| 81 |
decoded = tokenizer.batch_decode(summary_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
|
@@ -85,6 +74,23 @@ for in_text, out_text in zip(in_texts, decoded):
|
|
| 85 |
print(f"Out: \t{out_text}")
|
| 86 |
print()
|
| 87 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
## Wikipedia Dataset Used in Pre-Training
|
| 89 |
|
| 90 |
The BPE-tokenized version of the dataset, including metadata used in word transforms.
|
|
|
|
| 28 |
like so:
|
| 29 |
|
| 30 |
```python
|
| 31 |
+
BartForConditionalGeneration.from_pretrained("palat/bort", variant="bort-sp")
|
| 32 |
```
|
| 33 |
|
| 34 |
The following variants are available, pre-trained on the specified proportion of each task:
|
|
|
|
| 55 |
```python
|
| 56 |
from transformers import AutoTokenizer, BartForConditionalGeneration
|
| 57 |
|
|
|
|
|
|
|
|
|
|
| 58 |
in_texts = [
|
| 59 |
"Due to its coastal location, Long 路a瑟l蓹n路d winter temperatures are milder than most of the state.",
|
|
|
|
|
|
|
|
|
|
| 60 |
"Due to its coastal location, Long 路b路i失 winter temperatures are milder than most of the state.",
|
|
|
|
|
|
|
|
|
|
| 61 |
"Due to its coastal location, l蓴艐 路a瑟l蓹n路d winter temperatures are milder than most of the state.",
|
|
|
|
|
|
|
|
|
|
| 62 |
"Due to its coastal location, l蓴艐 路b路i失 winter temperatures are milder than most of the state.",
|
|
|
|
|
|
|
| 63 |
]
|
| 64 |
|
| 65 |
+
tokenizer = AutoTokenizer.from_pretrained("palat/bort")
|
| 66 |
+
model = BartForConditionalGeneration.from_pretrained("palat/bort")
|
| 67 |
+
|
| 68 |
inputs = tokenizer(in_texts, return_tensors="pt", padding=True)
|
| 69 |
summary_ids = model.generate(inputs["input_ids"], num_beams=2, min_length=0, max_length=2048)
|
| 70 |
decoded = tokenizer.batch_decode(summary_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
|
|
|
|
| 74 |
print(f"Out: \t{out_text}")
|
| 75 |
print()
|
| 76 |
```
|
| 77 |
+
|
| 78 |
+
Full output for the above example:
|
| 79 |
+
```
|
| 80 |
+
In: Due to its coastal location, l蓴艐 路a瑟l蓹n路d winter temperatures are milder than most of the state.
|
| 81 |
+
Out: Due to its coastal location, Long Island winter temperatures are milder than most of the state.
|
| 82 |
+
|
| 83 |
+
In: Due to its coastal location, l蓴艐 路b路i失 winter temperatures are milder than most of the state.
|
| 84 |
+
Out: Due to its coastal location, long beech winter temperatures are milder than most of the state.
|
| 85 |
+
|
| 86 |
+
In: Due to its coastal location, Long 路b路i失 winter temperatures are milder than most of the state.
|
| 87 |
+
Out: Due to its coastal location, Long Beach winter temperatures are milder than most of the state.
|
| 88 |
+
|
| 89 |
+
In: Due to its coastal location, l蓴艐f蓾d winter temperatures are milder than most of the state.
|
| 90 |
+
Out: Due to its coastal location, Longford winter temperatures are milder than most of the state.
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
|
| 94 |
## Wikipedia Dataset Used in Pre-Training
|
| 95 |
|
| 96 |
The BPE-tokenized version of the dataset, including metadata used in word transforms.
|