Instructions to use BluebrainAI/gpt2-wikitext with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BluebrainAI/gpt2-wikitext with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="BluebrainAI/gpt2-wikitext")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("BluebrainAI/gpt2-wikitext") model = AutoModelForCausalLM.from_pretrained("BluebrainAI/gpt2-wikitext", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use BluebrainAI/gpt2-wikitext with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "BluebrainAI/gpt2-wikitext" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "BluebrainAI/gpt2-wikitext", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/BluebrainAI/gpt2-wikitext
- SGLang
How to use BluebrainAI/gpt2-wikitext 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 "BluebrainAI/gpt2-wikitext" \ --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": "BluebrainAI/gpt2-wikitext", "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 "BluebrainAI/gpt2-wikitext" \ --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": "BluebrainAI/gpt2-wikitext", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use BluebrainAI/gpt2-wikitext with Docker Model Runner:
docker model run hf.co/BluebrainAI/gpt2-wikitext
| library_name: transformers | |
| tags: | |
| - generated_from_trainer | |
| metrics: | |
| - accuracy | |
| - bleu | |
| model-index: | |
| - name: gpt2-wikitext | |
| results: [] | |
| <!-- This model card has been generated automatically according to the information the Trainer had access to. You | |
| should probably proofread and complete it, then remove this comment. --> | |
| # gpt2-wikitext | |
| This model is a fine-tuned version of [](https://huggingface.co/) on an unknown dataset. | |
| It achieves the following results on the evaluation set: | |
| - Loss: 3.1673 | |
| - Accuracy: 0.4215 | |
| - Perplexity: 23.7437 | |
| - Bleu: 0.1486 | |
| ## Model description | |
| More information needed | |
| ## Intended uses & limitations | |
| More information needed | |
| ## Training and evaluation data | |
| More information needed | |
| ## Training procedure | |
| ### Training hyperparameters | |
| The following hyperparameters were used during training: | |
| - learning_rate: 0.0001 | |
| - train_batch_size: 64 | |
| - eval_batch_size: 64 | |
| - seed: 42 | |
| - optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments | |
| - lr_scheduler_type: linear | |
| - lr_scheduler_warmup_ratio: 0.1 | |
| - num_epochs: 5 | |
| ### Training results | |
| | Training Loss | Epoch | Step | Validation Loss | Accuracy | Perplexity | Bleu | | |
| |:-------------:|:------:|:----:|:---------------:|:--------:|:----------:|:------:| | |
| | 6.0809 | 0.2806 | 500 | 5.9591 | 0.1879 | 387.2722 | 0.0323 | | |
| | 5.0659 | 0.5612 | 1000 | 4.9189 | 0.2618 | 136.8551 | 0.0639 | | |
| | 4.338 | 0.8418 | 1500 | 4.2174 | 0.3219 | 67.8594 | 0.0857 | | |
| | 3.9468 | 1.1223 | 2000 | 3.8832 | 0.3532 | 48.5783 | 0.1094 | | |
| | 3.7577 | 1.4029 | 2500 | 3.7060 | 0.3685 | 40.6890 | 0.1226 | | |
| | 3.6483 | 1.6835 | 3000 | 3.5831 | 0.3787 | 35.9858 | 0.1296 | | |
| | 3.5432 | 1.9641 | 3500 | 3.4948 | 0.3875 | 32.9448 | 0.1360 | | |
| | 3.4221 | 2.2447 | 4000 | 3.4280 | 0.3939 | 30.8160 | 0.1306 | | |
| | 3.3602 | 2.5253 | 4500 | 3.3724 | 0.3991 | 29.1478 | 0.1391 | | |
| | 3.3285 | 2.8058 | 5000 | 3.3261 | 0.4038 | 27.8284 | 0.1369 | | |
| | 3.2072 | 3.0864 | 5500 | 3.2882 | 0.4077 | 26.7936 | 0.1447 | | |
| | 3.2002 | 3.3670 | 6000 | 3.2611 | 0.4112 | 26.0792 | 0.1472 | | |
| | 3.1782 | 3.6476 | 6500 | 3.2317 | 0.4138 | 25.3223 | 0.1421 | | |
| | 3.153 | 3.9282 | 7000 | 3.2080 | 0.4164 | 24.7294 | 0.1415 | | |
| | 3.0846 | 4.2088 | 7500 | 3.1915 | 0.4185 | 24.3249 | 0.1470 | | |
| | 3.0469 | 4.4893 | 8000 | 3.1789 | 0.4199 | 24.0205 | 0.1444 | | |
| | 3.0567 | 4.7699 | 8500 | 3.1673 | 0.4215 | 23.7437 | 0.1486 | | |
| ### Framework versions | |
| - Transformers 4.49.0 | |
| - Pytorch 2.6.0+cu124 | |
| - Datasets 3.3.2 | |
| - Tokenizers 0.21.0 | |