readme: add example code section
Browse files
README.md
CHANGED
@@ -27,6 +27,21 @@ for identifying biases and how to prevent them, as most research is currently do
|
|
27 |
|
28 |
---
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
# Changelog
|
32 |
|
|
|
27 |
|
28 |
---
|
29 |
|
30 |
+
# Text Generation
|
31 |
+
|
32 |
+
The following code snippet can be used to generate text with this German GPT-2 model:
|
33 |
+
|
34 |
+
```python
|
35 |
+
from transformers import pipeline
|
36 |
+
|
37 |
+
model_name = "stefan-it/german-gpt2-larger"
|
38 |
+
|
39 |
+
pipe = pipeline('text-generation', model=model_name, tokenizer=model_name)
|
40 |
+
|
41 |
+
text = pipe("Der Sinn des Lebens ist es", max_length=200)[0]["generated_text"]
|
42 |
+
|
43 |
+
print(text)
|
44 |
+
```
|
45 |
|
46 |
# Changelog
|
47 |
|