File size: 5,660 Bytes
2c01bad 99068d2 f8b7775 e04ce10 f8b7775 e04ce10 3238a54 f8b7775 3238a54 f8b7775 6f04bd4 f8b7775 6f04bd4 f8b7775 3238a54 f8b7775 3238a54 f8b7775 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
---
license: mit
language:
- de
library_name: transformers
---
# 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](https://huggingface.co/stefan-it/german-gpt2-larger), with the `pad_token` set to the `eos_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
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("kkirchheim/german-gpt2-medium")
model = AutoModelForCausalLM.from_pretrained("kkirchheim/german-gpt2-medium")
```
**Pipeline Code Example:**
```python
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](https://huggingface.co/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.
|