Text Generation
Transformers
PyTorch
TensorFlow
JAX
Safetensors
Dutch
gpt2
adaption
recycled
gpt2-small
text-generation-inference
Instructions to use GroNLP/gpt2-small-dutch-embeddings with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GroNLP/gpt2-small-dutch-embeddings with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GroNLP/gpt2-small-dutch-embeddings")# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("GroNLP/gpt2-small-dutch-embeddings") model = AutoModelForMultimodalLM.from_pretrained("GroNLP/gpt2-small-dutch-embeddings") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GroNLP/gpt2-small-dutch-embeddings with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GroNLP/gpt2-small-dutch-embeddings" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GroNLP/gpt2-small-dutch-embeddings", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/GroNLP/gpt2-small-dutch-embeddings
- SGLang
How to use GroNLP/gpt2-small-dutch-embeddings 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 "GroNLP/gpt2-small-dutch-embeddings" \ --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": "GroNLP/gpt2-small-dutch-embeddings", "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 "GroNLP/gpt2-small-dutch-embeddings" \ --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": "GroNLP/gpt2-small-dutch-embeddings", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use GroNLP/gpt2-small-dutch-embeddings with Docker Model Runner:
docker model run hf.co/GroNLP/gpt2-small-dutch-embeddings
metadata
language: nl
tags:
- adaption
- recycled
- gpt2-small
pipeline_tag: text-generation
GPT-2 recycled for Dutch (small, adapted lexical embeddings)
Wietse de Vries • Malvina Nissim
Model description
This model is based on the small OpenAI GPT-2 (gpt2) model.
The Transformer layer weights in this model are identical to the original English, model but the lexical layer has been retrained for a Dutch vocabulary.
For details, check out our paper on arXiv and the code on Github.
Related models
Dutch
gpt2-small-dutch-embeddings: Small model size with only retrained lexical embeddings.gpt2-small-dutch: Small model size with retrained lexical embeddings and additional fine-tuning of the full model. (Recommended)gpt2-medium-dutch-embeddings: Medium model size with only retrained lexical embeddings.
Italian
gpt2-small-italian-embeddings: Small model size with only retrained lexical embeddings.gpt2-small-italian: Small model size with retrained lexical embeddings and additional fine-tuning of the full model. (Recommended)gpt2-medium-italian-embeddings: Medium model size with only retrained lexical embeddings.
How to use
from transformers import pipeline
pipe = pipeline("text-generation", model="GroNLP/gpt2-small-dutch-embeddings")
from transformers import AutoTokenizer, AutoModel, TFAutoModel
tokenizer = AutoTokenizer.from_pretrained("GroNLP/gpt2-small-dutch-embeddings")
model = AutoModel.from_pretrained("GroNLP/gpt2-small-dutch-embeddings") # PyTorch
model = TFAutoModel.from_pretrained("GroNLP/gpt2-small-dutch-embeddings") # Tensorflow
BibTeX entry
@misc{devries2020good,
title={As good as new. How to successfully recycle English GPT-2 to make models for other languages},
author={Wietse de Vries and Malvina Nissim},
year={2020},
eprint={2012.05628},
archivePrefix={arXiv},
primaryClass={cs.CL}
}