Instructions to use thrunlab/gpt2-medium_gated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thrunlab/gpt2-medium_gated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="thrunlab/gpt2-medium_gated")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("thrunlab/gpt2-medium_gated") model = AutoModelForCausalLM.from_pretrained("thrunlab/gpt2-medium_gated", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use thrunlab/gpt2-medium_gated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thrunlab/gpt2-medium_gated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thrunlab/gpt2-medium_gated", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/thrunlab/gpt2-medium_gated
- SGLang
How to use thrunlab/gpt2-medium_gated 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 "thrunlab/gpt2-medium_gated" \ --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": "thrunlab/gpt2-medium_gated", "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 "thrunlab/gpt2-medium_gated" \ --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": "thrunlab/gpt2-medium_gated", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use thrunlab/gpt2-medium_gated with Docker Model Runner:
docker model run hf.co/thrunlab/gpt2-medium_gated
Commit History
-
Adding `safetensors` variant of this model
Verified signatureThis is an automated PR created with https://huggingface.co/spaces/safetensors/convert This new file is equivalent to `pytorch_model.bin` but safe in the sense that no arbitrary code can be put into it. These files also happen to load much faster than their pytorch counterpart: https://colab.research.google.com/github/huggingface/notebooks/blob/main/safetensors_doc/en/speed.ipynb The widgets on your model page will run using this model even if this is not merged making sure the file actually works. If you find any issues: please report here: https://huggingface.co/spaces/safetensors/convert/discussions Feel free to ignore this PR.27c7d9a
-
Training in progress, step 11000
de9791b -
Training in progress, step 10500
33b2945 -
Training in progress, step 10000
a0b04b8 -
Training in progress, step 9500
8e233df -
Training in progress, step 9000
96af1d8 -
Training in progress, step 8500
9437298 -
Training in progress, step 8000
eef8678 -
Training in progress, step 7500
482bb18 -
Training in progress, step 7000
0a35f64 -
Training in progress, step 6000
db3c4bb -
Training in progress, step 5000
0862761 -
Training in progress, step 4500
6f66e2b -
Training in progress, step 3500
8bc63c1 -
Training in progress, step 3000
f501cac -
Training in progress, step 2000
e19d166 -
Training in progress, step 1500
b0958cc -
Training in progress, step 1000
9409220 -
Training in progress, step 500
b78a838 -
Training in progress, step 15000
c7902e1 -
Training in progress, step 14500
1f678bc -
Training in progress, step 14000
18771ff -
Training in progress, step 13500
e7f6ac2 -
Training in progress, step 13000
6f132c8 -
Training in progress, step 12500
f6f26e4 -
Training in progress, step 12000
57836b0 -
Training in progress, step 11500
436ddaf -
Training in progress, step 11000
eb70e19 -
Training in progress, step 10500
232271c -
Training in progress, step 10000
49bb4e5 -
Training in progress, step 9500
ba0b566 -
Training in progress, step 9000
1320655 -
Training in progress, step 8000
95ab223 -
Training in progress, step 7500
d1e716e -
Training in progress, step 7000
b98080e -
Training in progress, step 6500
e3da00b -
Training in progress, step 6000
b940a5d -
Training in progress, step 5500
7579749 -
Training in progress, step 5000
bddb8e9 -
Training in progress, step 4500
8e8e002 -
Training in progress, step 4000
87ccb27 -
Training in progress, step 3500
e2cc070 -
Training in progress, step 3000
1da178b -
Training in progress, step 2500
6c9e24b -
Training in progress, step 2000
b035fd6 -
Training in progress, step 1500
4558af4 -
Training in progress, step 1000
4c957be -
Training in progress, step 500
9127a21 -
initial commit
ee08496