Instructions to use Bainbridge/gpt2-kl_01_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_01_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_01_06-hs_cn")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Bainbridge/gpt2-kl_01_06-hs_cn") model = AutoModelForCausalLM.from_pretrained("Bainbridge/gpt2-kl_01_06-hs_cn") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Bainbridge/gpt2-kl_01_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_01_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_01_06-hs_cn", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Bainbridge/gpt2-kl_01_06-hs_cn
- SGLang
How to use Bainbridge/gpt2-kl_01_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_01_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_01_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_01_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_01_06-hs_cn", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Bainbridge/gpt2-kl_01_06-hs_cn with Docker Model Runner:
docker model run hf.co/Bainbridge/gpt2-kl_01_06-hs_cn
gpt2-kl_01_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.5370
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 |
|---|---|---|---|
| 73.585 | 0.02 | 10 | 69.5774 |
| 46.144 | 0.04 | 20 | 32.9575 |
| 13.6058 | 0.06 | 30 | 10.6547 |
| 6.3387 | 0.08 | 40 | 4.6760 |
| 3.108 | 0.1 | 50 | 2.0148 |
| 1.4388 | 0.12 | 60 | 1.0426 |
| 1.0724 | 0.14 | 70 | 0.8244 |
| 0.8676 | 0.16 | 80 | 0.7317 |
| 0.7752 | 0.18 | 90 | 0.6445 |
| 0.758 | 0.2 | 100 | 0.6256 |
| 0.6361 | 0.22 | 110 | 0.6496 |
| 0.7083 | 0.24 | 120 | 0.5916 |
| 0.6812 | 0.26 | 130 | 0.5862 |
| 0.6816 | 0.28 | 140 | 0.6004 |
| 0.6585 | 0.3 | 150 | 0.6169 |
| 0.6748 | 0.32 | 160 | 0.5657 |
| 0.5729 | 0.34 | 170 | 0.5632 |
| 0.6929 | 0.36 | 180 | 0.5639 |
| 0.6994 | 0.38 | 190 | 0.5600 |
| 0.6378 | 0.4 | 200 | 0.5548 |
| 0.7489 | 0.42 | 210 | 0.5516 |
| 0.6943 | 0.44 | 220 | 0.5500 |
| 0.583 | 0.46 | 230 | 0.5526 |
| 0.6132 | 0.48 | 240 | 0.5489 |
| 0.6047 | 0.5 | 250 | 0.5489 |
| 0.6231 | 0.52 | 260 | 0.5420 |
| 0.6158 | 0.54 | 270 | 0.5399 |
| 0.6488 | 0.56 | 280 | 0.5399 |
| 0.6338 | 0.58 | 290 | 0.5374 |
| 0.5891 | 0.6 | 300 | 0.5400 |
| 0.6086 | 0.62 | 310 | 0.5388 |
| 0.7123 | 0.64 | 320 | 0.5365 |
| 0.5639 | 0.66 | 330 | 0.5387 |
| 0.5628 | 0.68 | 340 | 0.5351 |
| 0.581 | 0.7 | 350 | 0.5381 |
| 0.5602 | 0.72 | 360 | 0.5404 |
| 0.667 | 0.74 | 370 | 0.5370 |
Framework versions
- Transformers 4.29.0.dev0
- Pytorch 1.12.0a0+bd13bc6
- Datasets 2.12.0
- Tokenizers 0.13.3
- Downloads last month
- 2