Instructions to use josh-oo/german-gpt2-easy with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use josh-oo/german-gpt2-easy with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="josh-oo/german-gpt2-easy")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("josh-oo/german-gpt2-easy") model = AutoModelForCausalLM.from_pretrained("josh-oo/german-gpt2-easy") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use josh-oo/german-gpt2-easy with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "josh-oo/german-gpt2-easy" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "josh-oo/german-gpt2-easy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/josh-oo/german-gpt2-easy
- SGLang
How to use josh-oo/german-gpt2-easy with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "josh-oo/german-gpt2-easy" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "josh-oo/german-gpt2-easy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "josh-oo/german-gpt2-easy" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "josh-oo/german-gpt2-easy", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use josh-oo/german-gpt2-easy with Docker Model Runner:
docker model run hf.co/josh-oo/german-gpt2-easy
Easy German GPT2 Model
A language model for german easy language ("leichte Sprache") based on German GPT-2 model
Model Details
Initialized using the weights of German GPT-2 model.
Then fine-tuned for one epoch on "leichte Sprache" corpora consisting of:
- encyclopedia like data
- news like data
Hyperparamters used for fine-tuning:
tokenizer:
- max_length: 1024 (but trained with dynamic length, using the collator functions 'pad_to_multiple_of=8')
- stride: 64
- return_overflowing_tokens=True
training arguments
- num_train_epochs=1
- learning_rate=1e-3
- weight_decay=0.01
- per_device_train_batch_size=4
- gradient_accumulation_steps=4
- warmup_steps=200
- fp16=True
→ 25112 training items, trained on google colab GPU (30 min)
Evaluation results
The perplexity value is calculated based on an unseen dataset containing manually aligned standard german and "leichte Sprache" texts.
For calculation, the method described in this tutorial was used with the following values:
- max_length = 512
- stride = 256
For comparison: running the modified function on this example gives us a perplexity score of 18.2551
| Model | Perplexity "leichte Sprache" (Easy MDR News)) | Perplexity standard german (Standard MDR News) |
|---|---|---|
| German GPT-2 model | 23.8257 | 24.0301 |
| our model | 17.3053 | 48.6314 |
- Downloads last month
- 17