hf_mirrors/german-gpt2
Model Introduction
Files & versions
Analysis

German GPT-2 model

In this repository we release (yet another) GPT-2 model, that was trained on various texts for German.

The model is meant to be an entry point for fine-tuning on other texts, and it is definitely not as good or "dangerous" as the English GPT-3 model. We do not plan extensive PR or staged releases for this model 😉

Note: The model was initially released under an anonymous alias (anonymous-german-nlp/german-gpt2) so we now "de-anonymize" it.

Changelog

16.08.2021: Public release of re-trained version of our German GPT-2 model with better results.

15.11.2020: Initial release. Please use the tag v1.0 for [this older version].

Training corpora

We use pretty much the same corpora as used for training the DBMDZ BERT model, that can be found in this repository.

Thanks to the awesome Hugging Face team, it is possible to create byte-level BPE with their awesome Tokenizers library.

With the previously mentioned awesome Tokenizers library we created a 50K byte-level BPE vocab based on the training corpora.

Using the model

The model itself can be used in this way:

from openmind import is_torch_npu_available, AutoTokenizer, AutoModelWithLMHead
import torch

if is_torch_npu_available():
    device = "npu:0"
elif torch.cuda.is_available():
    device = "cuda:0"
else:
    device = "cpu"

tokenizer = AutoTokenizer.from_pretrained("SY_AICC/german-gpt2")

model = AutoModelWithLMHead.from_pretrained("SY_AICC/german-gpt2" , device=device)

However, text generation is a bit more interesting, so here's an example that shows how to use the great Transformers Pipelines for generating text:

from openmind import is_torch_npu_available, pipeline
import torch

if is_torch_npu_available():
    device = "npu:0"
elif torch.cuda.is_available():
    device = "cuda:0"
else:
    device = "cpu"

pipe = pipeline('text-generation', model="SY_AICC/german-gpt2",
                 tokenizer="SY_AICC/german-gpt2" , device=device)

text = pipe("Der Sinn des Lebens ist es", max_length=100)[0]["generated_text"]

print(text)

License

All models are licensed under MIT.

Contact (Bugs, Feedback, Contribution and more)

For questions about our BERT models just open an issue here 🤗

Acknowledgments

Research supported with Cloud TPUs from Google's TensorFlow Research Cloud (TFRC). Thanks for providing access to the TFRC ❤️