Instructions to use benjamin/gerpt2-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use benjamin/gerpt2-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="benjamin/gerpt2-large")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("benjamin/gerpt2-large") model = AutoModelForCausalLM.from_pretrained("benjamin/gerpt2-large") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use benjamin/gerpt2-large with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "benjamin/gerpt2-large" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "benjamin/gerpt2-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/benjamin/gerpt2-large
- SGLang
How to use benjamin/gerpt2-large 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 "benjamin/gerpt2-large" \ --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": "benjamin/gerpt2-large", "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 "benjamin/gerpt2-large" \ --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": "benjamin/gerpt2-large", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use benjamin/gerpt2-large with Docker Model Runner:
docker model run hf.co/benjamin/gerpt2-large
Update README.md
Browse files
README.md
CHANGED
|
@@ -9,9 +9,10 @@ license: mit
|
|
| 9 |
|
| 10 |
# GerPT2-large
|
| 11 |
|
| 12 |
-
|
| 13 |
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
See the [GPT2 model card](https://huggingface.co/gpt2) for considerations on limitations and bias. See the [GPT2 documentation](https://huggingface.co/transformers/model_doc/gpt2.html) for details on GPT2.
|
| 17 |
|
|
@@ -23,8 +24,7 @@ I evaluated both GerPT2-large and the other German GPT2, [dbmdz/german-gpt2](htt
|
|
| 23 |
|-------------------|--------------|-----------------|
|
| 24 |
| dbmdz/german-gpt2 | 49.47 | 62.92 |
|
| 25 |
| GerPT2 | 24.78 | 35.33 |
|
| 26 |
-
| GerPT2-large |
|
| 27 |
-
| | | |
|
| 28 |
|
| 29 |
See the script `evaluate.py` in the [GerPT2 Github repository](https://github.com/bminixhofer/gerpt2) for the code.
|
| 30 |
|
|
|
|
| 9 |
|
| 10 |
# GerPT2-large
|
| 11 |
|
| 12 |
+
German large and small versions of GPT2:
|
| 13 |
|
| 14 |
+
- https://huggingface.co/benjamin/gerpt2
|
| 15 |
+
- https://huggingface.co/benjamin/gerpt2-large
|
| 16 |
|
| 17 |
See the [GPT2 model card](https://huggingface.co/gpt2) for considerations on limitations and bias. See the [GPT2 documentation](https://huggingface.co/transformers/model_doc/gpt2.html) for details on GPT2.
|
| 18 |
|
|
|
|
| 24 |
|-------------------|--------------|-----------------|
|
| 25 |
| dbmdz/german-gpt2 | 49.47 | 62.92 |
|
| 26 |
| GerPT2 | 24.78 | 35.33 |
|
| 27 |
+
| GerPT2-large | __16.08__ | __23.26__ |
|
|
|
|
| 28 |
|
| 29 |
See the script `evaluate.py` in the [GerPT2 Github repository](https://github.com/bminixhofer/gerpt2) for the code.
|
| 30 |
|