Instructions to use zehao888/gpt2-pretrain_new with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zehao888/gpt2-pretrain_new with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zehao888/gpt2-pretrain_new")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zehao888/gpt2-pretrain_new") model = AutoModelForCausalLM.from_pretrained("zehao888/gpt2-pretrain_new", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use zehao888/gpt2-pretrain_new with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zehao888/gpt2-pretrain_new" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zehao888/gpt2-pretrain_new", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/zehao888/gpt2-pretrain_new
- SGLang
How to use zehao888/gpt2-pretrain_new 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 "zehao888/gpt2-pretrain_new" \ --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": "zehao888/gpt2-pretrain_new", "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 "zehao888/gpt2-pretrain_new" \ --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": "zehao888/gpt2-pretrain_new", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use zehao888/gpt2-pretrain_new with Docker Model Runner:
docker model run hf.co/zehao888/gpt2-pretrain_new
gpt2-pretrain_new
This model is a fine-tuned version of gpt2 on the None dataset. It achieves the following results on the evaluation set:
- Loss: 5.1443
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: 3e-05
- train_batch_size: 48
- eval_batch_size: 48
- 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: cosine
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 50
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 8.3786 | 1.8519 | 100 | 8.0241 |
| 7.5755 | 3.7037 | 200 | 7.1144 |
| 6.7409 | 5.5556 | 300 | 6.4557 |
| 6.171 | 7.4074 | 400 | 6.0812 |
| 5.8181 | 9.2593 | 500 | 5.8451 |
| 5.5475 | 11.1111 | 600 | 5.6727 |
| 5.3334 | 12.9630 | 700 | 5.5440 |
| 5.1484 | 14.8148 | 800 | 5.4523 |
| 4.9984 | 16.6667 | 900 | 5.3853 |
| 4.8624 | 18.5185 | 1000 | 5.3275 |
| 4.7532 | 20.3704 | 1100 | 5.2845 |
| 4.633 | 22.2222 | 1200 | 5.2454 |
| 4.5402 | 24.0741 | 1300 | 5.2166 |
| 4.444 | 25.9259 | 1400 | 5.1897 |
| 4.3621 | 27.7778 | 1500 | 5.1785 |
| 4.2848 | 29.6296 | 1600 | 5.1639 |
| 4.2343 | 31.4815 | 1700 | 5.1573 |
| 4.1692 | 33.3333 | 1800 | 5.1483 |
| 4.125 | 35.1852 | 1900 | 5.1528 |
| 4.087 | 37.0370 | 2000 | 5.1461 |
| 4.0493 | 38.8889 | 2100 | 5.1443 |
| 4.027 | 40.7407 | 2200 | 5.1476 |
| 4.0032 | 42.5926 | 2300 | 5.1464 |
Framework versions
- Transformers 4.57.1
- Pytorch 2.9.0+cu126
- Datasets 4.0.0
- Tokenizers 0.22.1
- Downloads last month
- 7