Update README.md
Browse files
README.md
CHANGED
|
@@ -34,11 +34,22 @@ inference:
|
|
| 34 |
|
| 35 |
# 💡GENIUS – generating text using sketches!
|
| 36 |
|
| 37 |
-
**基于草稿的文本生成模型**
|
| 38 |
|
| 39 |
- **Paper: [GENIUS: Sketch-based Language Model Pre-training via Extreme and Selective Masking for Text Generation and Augmentation](https://arxiv.org/abs/2211.10330)**
|
| 40 |
- **GitHub: [GENIUS, Pre-training/Data Augmentation Tutorial](https://github.com/beyondguo/genius)**
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
💡**GENIUS** is a powerful conditional text generation model using sketches as input, which can fill in the missing contexts for a given **sketch** (key information consisting of textual spans, phrases, or words, concatenated by mask tokens). GENIUS is pre-trained on a large-scale textual corpus with a novel *reconstruction from sketch* objective using an *extreme and selective masking* strategy, enabling it to generate diverse and high-quality texts given sketches.
|
| 43 |
|
| 44 |
**GENIUS** can also be used as a general textual **data augmentation tool** for **various NLP tasks** (including sentiment analysis, topic classification, NER, and QA).
|
|
|
|
| 34 |
|
| 35 |
# 💡GENIUS – generating text using sketches!
|
| 36 |
|
|
|
|
| 37 |
|
| 38 |
- **Paper: [GENIUS: Sketch-based Language Model Pre-training via Extreme and Selective Masking for Text Generation and Augmentation](https://arxiv.org/abs/2211.10330)**
|
| 39 |
- **GitHub: [GENIUS, Pre-training/Data Augmentation Tutorial](https://github.com/beyondguo/genius)**
|
| 40 |
|
| 41 |
+
**How to use:**
|
| 42 |
+
```python
|
| 43 |
+
from transformers import pipeline
|
| 44 |
+
# 1. load the model with the huggingface `pipeline`
|
| 45 |
+
genius = pipeline("text2text-generation", model='beyond/genius-large', device=0)
|
| 46 |
+
# 2. provide a sketch (joint by <mask> tokens)
|
| 47 |
+
sketch = "<mask> Conference on Empirical Methods <mask> submission of research papers <mask> Deep Learning <mask>"
|
| 48 |
+
# 3. here we go!
|
| 49 |
+
generated_text = genius(sketch, num_beams=3, do_sample=True, max_length=200)[0]['generated_text']
|
| 50 |
+
print(generated_text)
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
💡**GENIUS** is a powerful conditional text generation model using sketches as input, which can fill in the missing contexts for a given **sketch** (key information consisting of textual spans, phrases, or words, concatenated by mask tokens). GENIUS is pre-trained on a large-scale textual corpus with a novel *reconstruction from sketch* objective using an *extreme and selective masking* strategy, enabling it to generate diverse and high-quality texts given sketches.
|
| 54 |
|
| 55 |
**GENIUS** can also be used as a general textual **data augmentation tool** for **various NLP tasks** (including sentiment analysis, topic classification, NER, and QA).
|