Instructions to use Finnish-NLP/gpt2-medium-finnish with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Finnish-NLP/gpt2-medium-finnish with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Finnish-NLP/gpt2-medium-finnish")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Finnish-NLP/gpt2-medium-finnish") model = AutoModelForCausalLM.from_pretrained("Finnish-NLP/gpt2-medium-finnish", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Finnish-NLP/gpt2-medium-finnish with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Finnish-NLP/gpt2-medium-finnish" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Finnish-NLP/gpt2-medium-finnish", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Finnish-NLP/gpt2-medium-finnish
- SGLang
How to use Finnish-NLP/gpt2-medium-finnish 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 "Finnish-NLP/gpt2-medium-finnish" \ --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": "Finnish-NLP/gpt2-medium-finnish", "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 "Finnish-NLP/gpt2-medium-finnish" \ --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": "Finnish-NLP/gpt2-medium-finnish", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Finnish-NLP/gpt2-medium-finnish with Docker Model Runner:
docker model run hf.co/Finnish-NLP/gpt2-medium-finnish
- Xet hash:
- 9fcd4f19ad7998c594229ebe62923de08d6c92c103f1bc717850b87305014188
- Size of remote file:
- 1.44 GB
- SHA256:
- 5070fde5ed7d34c5230f1c11aab6352b27c8e33a31ae77170bf4b44486d038d7
·
Xet efficiently stores Large Files inside Git, intelligently splitting files into unique chunks and accelerating uploads and downloads. More info.