Commit
·
97f510a
1
Parent(s):
17e7bc5
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,6 +10,8 @@ _Work in progress._
|
|
| 10 |
|
| 11 |
Language model for inclusive language in German, fine-tuned on [mT5](https://arxiv.org/abs/2010.11934).
|
| 12 |
|
|
|
|
|
|
|
| 13 |
## Tasks
|
| 14 |
|
| 15 |
- **DETECT**: Recognizes instances of the generic masculine, and of other exclusive language. To do.
|
|
@@ -24,9 +26,29 @@ Language model for inclusive language in German, fine-tuned on [mT5](https://arx
|
|
| 24 |
|
| 25 |
◀️ `Das wartende Kollegium wunderte sich.`
|
| 26 |
|
| 27 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
## License
|
| 32 |
|
|
|
|
| 10 |
|
| 11 |
Language model for inclusive language in German, fine-tuned on [mT5](https://arxiv.org/abs/2010.11934).
|
| 12 |
|
| 13 |
+
An experimental model version is released [on Huggingface](https://huggingface.co/diversifix/diversiformer).
|
| 14 |
+
|
| 15 |
## Tasks
|
| 16 |
|
| 17 |
- **DETECT**: Recognizes instances of the generic masculine, and of other exclusive language. To do.
|
|
|
|
| 26 |
|
| 27 |
◀️ `Das wartende Kollegium wunderte sich.`
|
| 28 |
|
| 29 |
+
## Usage
|
| 30 |
+
|
| 31 |
+
```python
|
| 32 |
+
from transformers import T5Tokenizer, TFT5ForConditionalGeneration
|
| 33 |
+
|
| 34 |
+
tokenizer = T5Tokenizer.from_pretrained("google/mt5-small")
|
| 35 |
+
model = TFT5ForConditionalGeneration.from_pretrained("diversifix/diversiformer")
|
| 36 |
+
|
| 37 |
+
def generate(prompt, tokenizer, model):
|
| 38 |
+
tokenized_text = tokenizer.encode(prompt, return_tensors="tf")
|
| 39 |
+
ids = model.generate(tokenized_text, max_length=500)
|
| 40 |
+
output = tokenizer.decode(ids[0], skip_special_tokens=True)
|
| 41 |
+
return output
|
| 42 |
+
|
| 43 |
+
prompts = [
|
| 44 |
+
'Ersetze "Schüler" durch "Schülerin oder Schüler": Die Schüler kamen zu spät.',
|
| 45 |
+
'Ersetze "Lehrer" durch "Kollegium": Die wartenden Lehrer wunderten sich.',
|
| 46 |
+
]
|
| 47 |
|
| 48 |
+
for prompt in prompts:
|
| 49 |
+
output = generate(prompt, tokenizer, model)
|
| 50 |
+
print(f"{prompt}\n{output}\n\n")
|
| 51 |
+
```
|
| 52 |
|
| 53 |
## License
|
| 54 |
|