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
Update README.md
Browse files
README.md
CHANGED
|
@@ -119,6 +119,11 @@ Evaluation was done using the *validation* split of the [mc4_fi_cleaned](https:/
|
|
| 119 |
|Finnish-NLP/gpt2-finnish |44.19 |
|
| 120 |
|Finnish-NLP/gpt2-large-finnish |**30.74** |
|
| 121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
## Team Members
|
| 123 |
|
| 124 |
- Aapo Tanskanen, [Hugging Face profile](https://huggingface.co/aapot), [LinkedIn profile](https://www.linkedin.com/in/aapotanskanen/)
|
|
|
|
| 119 |
|Finnish-NLP/gpt2-finnish |44.19 |
|
| 120 |
|Finnish-NLP/gpt2-large-finnish |**30.74** |
|
| 121 |
|
| 122 |
+
## Acknowledgements
|
| 123 |
+
|
| 124 |
+
This project would not have been possible without compute generously provided by Google through the
|
| 125 |
+
[TPU Research Cloud](https://sites.research.google/trc/).
|
| 126 |
+
|
| 127 |
## Team Members
|
| 128 |
|
| 129 |
- Aapo Tanskanen, [Hugging Face profile](https://huggingface.co/aapot), [LinkedIn profile](https://www.linkedin.com/in/aapotanskanen/)
|