Instructions to use Lilin004/luxun-gpt2-optimized2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lilin004/luxun-gpt2-optimized2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lilin004/luxun-gpt2-optimized2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Lilin004/luxun-gpt2-optimized2") model = AutoModelForCausalLM.from_pretrained("Lilin004/luxun-gpt2-optimized2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lilin004/luxun-gpt2-optimized2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lilin004/luxun-gpt2-optimized2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lilin004/luxun-gpt2-optimized2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Lilin004/luxun-gpt2-optimized2
- SGLang
How to use Lilin004/luxun-gpt2-optimized2 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 "Lilin004/luxun-gpt2-optimized2" \ --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": "Lilin004/luxun-gpt2-optimized2", "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 "Lilin004/luxun-gpt2-optimized2" \ --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": "Lilin004/luxun-gpt2-optimized2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Lilin004/luxun-gpt2-optimized2 with Docker Model Runner:
docker model run hf.co/Lilin004/luxun-gpt2-optimized2
luxun-gpt2-optimized2
This model is a fine-tuned version of uer/gpt2-chinese-cluecorpussmall on the None dataset. It achieves the following results on the evaluation set:
- Loss: 2.7527
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: 4
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 4
- total_train_batch_size: 16
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 0.1
- num_epochs: 10
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 21.3680 | 0.1361 | 20 | 4.9754 |
| 21.1391 | 0.2721 | 40 | 4.7909 |
| 19.4552 | 0.4082 | 60 | 4.6759 |
| 19.1040 | 0.5442 | 80 | 4.5777 |
| 19.4053 | 0.6803 | 100 | 4.4904 |
| 18.4277 | 0.8163 | 120 | 4.4121 |
| 18.2665 | 0.9524 | 140 | 4.3433 |
| 17.9532 | 1.0884 | 160 | 4.2720 |
| 17.4830 | 1.2245 | 180 | 4.2146 |
| 17.1754 | 1.3605 | 200 | 4.1561 |
| 17.0501 | 1.4966 | 220 | 4.0919 |
| 16.7780 | 1.6327 | 240 | 4.0369 |
| 16.6452 | 1.7687 | 260 | 3.9848 |
| 16.4966 | 1.9048 | 280 | 3.9273 |
| 15.5722 | 2.0408 | 300 | 3.8965 |
| 15.8068 | 2.1769 | 320 | 3.8402 |
| 15.7545 | 2.3129 | 340 | 3.8010 |
| 15.8805 | 2.4490 | 360 | 3.7666 |
| 15.0228 | 2.5850 | 380 | 3.7225 |
| 14.9995 | 2.7211 | 400 | 3.6866 |
| 14.4941 | 2.8571 | 420 | 3.6518 |
| 14.9387 | 2.9932 | 440 | 3.6127 |
| 14.3115 | 3.1293 | 460 | 3.5830 |
| 14.3165 | 3.2653 | 480 | 3.5469 |
| 14.0445 | 3.4014 | 500 | 3.5137 |
| 13.7494 | 3.5374 | 520 | 3.4837 |
| 13.7659 | 3.6735 | 540 | 3.4434 |
| 13.9861 | 3.8095 | 560 | 3.4142 |
| 14.1536 | 3.9456 | 580 | 3.3838 |
| 13.1904 | 4.0816 | 600 | 3.3558 |
| 12.8714 | 4.2177 | 620 | 3.3279 |
| 13.3145 | 4.3537 | 640 | 3.3033 |
| 13.2822 | 4.4898 | 660 | 3.2687 |
| 12.6844 | 4.6259 | 680 | 3.2473 |
| 12.7821 | 4.7619 | 700 | 3.2254 |
| 12.8397 | 4.8980 | 720 | 3.1974 |
| 12.0735 | 5.0340 | 740 | 3.1780 |
| 12.0329 | 5.1701 | 760 | 3.1471 |
| 12.2971 | 5.3061 | 780 | 3.1263 |
| 12.0071 | 5.4422 | 800 | 3.1036 |
| 12.0631 | 5.5782 | 820 | 3.0795 |
| 11.7063 | 5.7143 | 840 | 3.0671 |
| 11.8699 | 5.8503 | 860 | 3.0479 |
| 11.9551 | 5.9864 | 880 | 3.0283 |
| 11.7066 | 6.1224 | 900 | 3.0070 |
| 11.6296 | 6.2585 | 920 | 2.9910 |
| 11.2781 | 6.3946 | 940 | 2.9774 |
| 11.4764 | 6.5306 | 960 | 2.9600 |
| 11.6617 | 6.6667 | 980 | 2.9460 |
| 11.2081 | 6.8027 | 1000 | 2.9248 |
| 10.9386 | 6.9388 | 1020 | 2.9123 |
| 11.4737 | 7.0748 | 1040 | 2.8967 |
| 10.6856 | 7.2109 | 1060 | 2.8874 |
| 10.6605 | 7.3469 | 1080 | 2.8752 |
| 10.6367 | 7.4830 | 1100 | 2.8627 |
| 11.3121 | 7.6190 | 1120 | 2.8528 |
| 10.8436 | 7.7551 | 1140 | 2.8385 |
| 10.5651 | 7.8912 | 1160 | 2.8303 |
| 10.3416 | 8.0272 | 1180 | 2.8211 |
| 10.7753 | 8.1633 | 1200 | 2.8104 |
| 10.5844 | 8.2993 | 1220 | 2.8035 |
| 10.2085 | 8.4354 | 1240 | 2.7933 |
| 10.4647 | 8.5714 | 1260 | 2.7872 |
| 10.4550 | 8.7075 | 1280 | 2.7822 |
| 10.7316 | 8.8435 | 1300 | 2.7765 |
| 10.3152 | 8.9796 | 1320 | 2.7728 |
| 10.3639 | 9.1156 | 1340 | 2.7677 |
| 10.3007 | 9.2517 | 1360 | 2.7638 |
| 10.4514 | 9.3878 | 1380 | 2.7591 |
| 10.4867 | 9.5238 | 1400 | 2.7576 |
| 10.1711 | 9.6599 | 1420 | 2.7557 |
| 10.2853 | 9.7959 | 1440 | 2.7538 |
| 10.5973 | 9.9320 | 1460 | 2.7527 |
Framework versions
- Transformers 5.0.0
- Pytorch 2.10.0+cu128
- Datasets 4.0.0
- Tokenizers 0.22.2
- Downloads last month
- 9
Model tree for Lilin004/luxun-gpt2-optimized2
Base model
uer/gpt2-chinese-cluecorpussmall