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")# pip install -U transformers accelerate # 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", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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
Download model.safetensors from Bainbridge/gpt2-kl_01_06-hs_cn: direct link, hf CLI and curl.
- Browser
- Download file 1.44 GB
-
https://huggingface.co/Bainbridge/gpt2-kl_01_06-hs_cn/resolve/refs%2Fpr%2F1/model.safetensors
- Command line
-
hf download hf://Bainbridge/gpt2-kl_01_06-hs_cn@refs/pr/1/model.safetensors
-
curl -L -o model.safetensors https://huggingface.co/Bainbridge/gpt2-kl_01_06-hs_cn/resolve/refs%2Fpr%2F1/model.safetensors
1.44 GB
- Xet hash:
- 78b72f7a20a98fbd01d86c21087116f7e599aa4bf6506e22916f6cf533ccc819
- Size of remote file:
- 1.44 GB
- SHA256:
- 07c2253f1ffc46c18878f01403f4aa7f75c2e39b802322fa64ce774b2a1792e1
·
Xet efficiently stores Large Files inside Git, intelligently splitting files into unique chunks and accelerating uploads and downloads. More info.