German GPT-2 Medium (358M Parameters)
This model is a German-only variant of GPT-2 with approximately 358 million parameters and an extended context size of 2048 tokens. It is pre-trained on 300 GB of German text data and is intended as a base model for text generation tasks in German.
- Version: 1.0 (Initial and likely final release)
- Model Type: Pre-trained language model
- Tokenizer: Utilizes the tokenizer from stefan-it/german-gpt2-larger, with the
pad_token
set to theeos_token
.
Training Data
The model is trained on a large-scale German text corpus derived from Common Crawl data, filtered to include high-quality text such as newspapers and government websites.
- Name: German Colossal Clean Common Crawl (GC4) Corpus (filtered version)
- This model is trained on all of the HEAD files from the GC4 corpus.
- Size: Approximately 300 GB of text data.
- Knowledge Cutoff: 2020
Intended Use
- Base model for fine-tuning on German text generation tasks.
- Research in natural language processing for the German language.
Users: NLP researchers, developers, and practitioners focusing on German language applications.
Limitations
- Biases: The model may reflect biases present in the training data, including stereotypes or offensive content.
- No Content Filtering: The model lacks guardrails and may generate inappropriate or harmful text.
- Outdated Information: Contains knowledge up to 2020; does not include events after this date.
Ethical Considerations and Bias
The presented and trained language model is for research purposes only. The GC4 corpus—used for training—contains crawled texts from the internet. Thus, this GPT-2 model can be considered as highly biased, potentially encoding stereotypical associations along gender, race, ethnicity, and disability status. Before using and working with the released checkpoints, it is highly recommended to read:
- "On the Dangers of Stochastic Parrots: Can Language Models Be Too Big?" by Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell.
Potential Risks:
- Generation of biased or offensive content.
- Misrepresentation of factual information.
- Propagation of stereotypes.
Mitigation Strategies:
- Implement bias mitigation techniques and content filtering appropriate for your use case.
- Use the model in controlled settings with human oversight.
- Perform thorough evaluation before deployment.
How to Use
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("kkirchheim/german-gpt2-medium")
model = AutoModelForCausalLM.from_pretrained("kkirchheim/german-gpt2-medium")
Pipeline Code Example:
from transformers import pipeline
model_name = "kkirchheim/german-gpt2-medium"
generator = pipeline('text-generation', model=model_name, tokenizer=tokenizer)
prompt = "Der Sinn des Lebens ist"
outputs = generator(prompt, max_length=50, num_return_sequences=1)
print(outputs[0]['generated_text'])
Acknowledgments
- Funding: Chair of Software and Systems Engineering at the Otto-von-Guericke University of Magdeburg.
- Contributors: Konstantin Kirchheim
- Third-Party Resources:
- Tokenizer and initial model architecture from stefan-it/german-gpt2-larger.
Disclaimer: This model is provided for research purposes only and comes with no warranties. The authors are not responsible for any output generated by the model. Users should exercise caution and are responsible for compliance with applicable laws and regulations.
Changelog:
- Version 1.0: Initial release.
Future Work:
- No planned updates or future releases at this time.
Notes:
- Ethical Use: Users should ensure that the model is used ethically and responsibly, considering potential impacts on individuals and society.
- Legal Considerations: Users should perform their own due diligence regarding the permissible use of the model and its outputs.
FAQ:
Q: Can I use this model for commercial purposes?
A: The model is intended for research purposes only. Commercial use is not advised without proper legal consultation.
Q: How do I address potential biases in the model's outputs?
A: Implement bias mitigation strategies and content filtering appropriate for your use case. Always review the model's outputs critically.
Training Procedure
Hyperparameters:
- Optimizer: AdamW (Torch implementation)
- Learning Rate:
6e-4
- Batch Size:
- Per Device Train Batch Size: 12
- Gradient Accumulation Steps: 12
- Effective Batch Size: 144 (12 * 12)
- Number of Epochs: 1 (single pass over the dataset)
- Warmup Steps: 1,000
- Weight Decay: 0.1
- Mixed Precision Training: Enabled (
fp16=True
) - Gradient Checkpointing: Enabled
- Evaluation Strategy:
- Evaluation Steps: Every 100 steps
- Per Device Evaluation Batch Size: 12
- Logging:
- Logging Steps: Every 10 steps
- Logging to: TensorBoard
Training Hardware:
- Compute Resources: 4 NVIDIA A100 GPUs with 40 GB memory each.
- Training Duration: Approximately 1.5 months.
- Parallelism: Distributed Data Parallel (DDP)
Additional Training Details:
- Resume from Checkpoint: Enabled (
resume_from_checkpoint=True
) - Optimizer Settings:
- Used
adamw_torch
optimizer.
- Used
- Downloads last month
- 182