Instructions to use Bainbridge/gpt2-kl_1_06-hs_cn with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Bainbridge/gpt2-kl_1_06-hs_cn with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Bainbridge/gpt2-kl_1_06-hs_cn")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Bainbridge/gpt2-kl_1_06-hs_cn") model = AutoModelForCausalLM.from_pretrained("Bainbridge/gpt2-kl_1_06-hs_cn", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Bainbridge/gpt2-kl_1_06-hs_cn with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Bainbridge/gpt2-kl_1_06-hs_cn" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Bainbridge/gpt2-kl_1_06-hs_cn", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Bainbridge/gpt2-kl_1_06-hs_cn
- SGLang
How to use Bainbridge/gpt2-kl_1_06-hs_cn 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 "Bainbridge/gpt2-kl_1_06-hs_cn" \ --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": "Bainbridge/gpt2-kl_1_06-hs_cn", "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 "Bainbridge/gpt2-kl_1_06-hs_cn" \ --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": "Bainbridge/gpt2-kl_1_06-hs_cn", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Bainbridge/gpt2-kl_1_06-hs_cn with Docker Model Runner:
docker model run hf.co/Bainbridge/gpt2-kl_1_06-hs_cn
gpt2-kl_1_06-hs_cn
This model is a fine-tuned version of gpt2-medium on an unknown dataset. It achieves the following results on the evaluation set:
- Loss: 0.5352
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: 5e-05
- train_batch_size: 8
- eval_batch_size: 4
- seed: 21
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 3.0
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 74.175 | 0.02 | 10 | 69.5742 |
| 46.6833 | 0.04 | 20 | 32.9573 |
| 14.147 | 0.06 | 30 | 10.6344 |
| 7.4081 | 0.08 | 40 | 4.2202 |
| 4.1981 | 0.1 | 50 | 2.0325 |
| 1.9903 | 0.12 | 60 | 1.0829 |
| 1.5743 | 0.14 | 70 | 0.8595 |
| 1.4537 | 0.16 | 80 | 0.7859 |
| 1.4022 | 0.18 | 90 | 0.7212 |
| 1.3332 | 0.2 | 100 | 0.6727 |
| 1.1681 | 0.22 | 110 | 0.6850 |
| 1.1991 | 0.24 | 120 | 0.5978 |
| 1.2297 | 0.26 | 130 | 0.6137 |
| 1.3475 | 0.28 | 140 | 0.5888 |
| 1.3468 | 0.3 | 150 | 0.5783 |
| 1.2516 | 0.32 | 160 | 0.5765 |
| 1.1055 | 0.34 | 170 | 0.5752 |
| 1.2874 | 0.36 | 180 | 0.5684 |
| 1.3511 | 0.38 | 190 | 0.5613 |
| 1.1492 | 0.4 | 200 | 0.5571 |
| 1.3802 | 0.42 | 210 | 0.5567 |
| 1.3072 | 0.44 | 220 | 0.5527 |
| 1.1026 | 0.46 | 230 | 0.5538 |
| 1.199 | 0.48 | 240 | 0.5497 |
| 1.1124 | 0.5 | 250 | 0.5513 |
| 1.1861 | 0.52 | 260 | 0.5495 |
| 1.1603 | 0.54 | 270 | 0.5434 |
| 1.2407 | 0.56 | 280 | 0.5451 |
| 1.1338 | 0.58 | 290 | 0.5437 |
| 1.0556 | 0.6 | 300 | 0.5428 |
| 1.2218 | 0.62 | 310 | 0.5392 |
| 1.3505 | 0.64 | 320 | 0.5408 |
| 1.1001 | 0.66 | 330 | 0.5426 |
| 1.1123 | 0.68 | 340 | 0.5385 |
| 1.1046 | 0.7 | 350 | 0.5385 |
| 1.1291 | 0.72 | 360 | 0.5383 |
| 1.2087 | 0.74 | 370 | 0.5378 |
| 1.1888 | 0.76 | 380 | 0.5380 |
| 1.1634 | 0.78 | 390 | 0.5363 |
| 1.249 | 0.8 | 400 | 0.5351 |
| 1.1197 | 0.82 | 410 | 0.5350 |
| 1.1508 | 0.84 | 420 | 0.5366 |
| 1.2025 | 0.86 | 430 | 0.5340 |
| 1.13 | 0.88 | 440 | 0.5347 |
| 1.1664 | 0.9 | 450 | 0.5371 |
| 1.048 | 0.92 | 460 | 0.5352 |
Framework versions
- Transformers 4.28.0
- Pytorch 1.11.0+cu113
- Datasets 2.11.0
- Tokenizers 0.12.1
- Downloads last month
- 13