Instructions to use SushantGautam/gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SushantGautam/gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SushantGautam/gpt2")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SushantGautam/gpt2") model = AutoModelForCausalLM.from_pretrained("SushantGautam/gpt2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SushantGautam/gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SushantGautam/gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SushantGautam/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SushantGautam/gpt2
- SGLang
How to use SushantGautam/gpt2 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 "SushantGautam/gpt2" \ --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": "SushantGautam/gpt2", "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 "SushantGautam/gpt2" \ --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": "SushantGautam/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SushantGautam/gpt2 with Docker Model Runner:
docker model run hf.co/SushantGautam/gpt2
Commit History
-
Training in progress, step 136500
5d3651d -
Training in progress, step 136000
875ff14 -
Training in progress, step 135500
55856d1 -
Training in progress, step 135000
12a1014 -
Training in progress, step 134500
ee2cc0b -
Training in progress, step 134000
27490e4 -
Training in progress, step 133000
168453a -
Training in progress, step 132500
50b0cd7 -
Training in progress, step 131500
f065b95 -
Training in progress, step 131000
29d26a6 -
Training in progress, step 130500
efcd78f -
Training in progress, step 130000
f371576 -
Training in progress, step 129000
c80db79 -
Training in progress, step 128500
11a5ec4 -
Training in progress, step 128000
50ee2ff -
Training in progress, step 127000
c7b1fa4 -
Training in progress, step 126500
79df1a9 -
Training in progress, step 125500
f290a1f -
Training in progress, step 124500
ee22782 -
Training in progress, step 123500
e2fd729 -
Training in progress, step 122500
32e365c -
Training in progress, step 121500
eaa78ca -
Training in progress, step 121000
40c5f23 -
Training in progress, step 120500
4b98dc0 -
Training in progress, step 120000
d6731ba -
Training in progress, step 119000
7facaee -
Training in progress, step 118500
4cb5114 -
Training in progress, step 117500
332aa48 -
Training in progress, step 116500
236a3c4 -
Training in progress, step 116000
ffdb31a -
Training in progress, step 115500
f31df98 -
Training in progress, step 114500
ff1f28e -
Training in progress, step 114000
5af35ea -
Training in progress, step 113500
b1f1515 -
Training in progress, step 112500
2c162e2 -
Training in progress, step 111500
1e53e6e -
Training in progress, step 110500
eb4cd10 -
Training in progress, step 110000
ae86833 -
Training in progress, step 109500
4d8577d -
Training in progress, step 109000
cfb7c62 -
Training in progress, step 108500
0189cef -
Training in progress, step 108000
0801cca -
Training in progress, step 107500
1146f4f -
Training in progress, step 107000
d225b0a -
Training in progress, step 106500
3e08707 -
Training in progress, step 106000
eacf072 -
Training in progress, step 105500
37261df -
Training in progress, step 104500
6eb2478 -
Training in progress, step 103500
8027820 -
Training in progress, step 103000
4482348