Instructions to use Stable-string/gpt2-zh-novel-ancient with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Stable-string/gpt2-zh-novel-ancient with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Stable-string/gpt2-zh-novel-ancient")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Stable-string/gpt2-zh-novel-ancient") model = AutoModelForCausalLM.from_pretrained("Stable-string/gpt2-zh-novel-ancient", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Stable-string/gpt2-zh-novel-ancient with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Stable-string/gpt2-zh-novel-ancient" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Stable-string/gpt2-zh-novel-ancient", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Stable-string/gpt2-zh-novel-ancient
- SGLang
How to use Stable-string/gpt2-zh-novel-ancient 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 "Stable-string/gpt2-zh-novel-ancient" \ --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": "Stable-string/gpt2-zh-novel-ancient", "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 "Stable-string/gpt2-zh-novel-ancient" \ --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": "Stable-string/gpt2-zh-novel-ancient", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Stable-string/gpt2-zh-novel-ancient with Docker Model Runner:
docker model run hf.co/Stable-string/gpt2-zh-novel-ancient
Commit History
-
Update README.md
85004cb -
Upload pytorch_model.bin
3a1b3fc -
Delete pytorch_model.bin
3f5a307 -
Update README.md
e1b12fb -
Update README.md
be0220e -
Update README.md
7af3be7 -
Update README.md
de29c72
-
Update README.md
94c6221 -
Upload chinese_vocab.model
64eb817 -
Upload 2 files
2363dc7 -
Delete tokenizer_config.json
ea058ce -
Delete spiece.model
fd5afb3 -
Delete special_tokens_map.json
47803b7 -
Delete generation_config.json
b5f9057 -
Update generation_config.json
0c18289 -
Delete config.json
71f5fb0 -
Upload pytorch_model.bin
125f2b8 -
Upload 5 files
a2e5945 -
Delete pytorch_model.bin
9b4a93c -
Delete config.json
cce480b -
Delete generation_config.json
ba17df9 -
Delete chinese_vocab.model
a303d59 -
Update README.md
c7b5818 -
Update README.md
764cc01 -
Update README.md
795b562 -
Update README.md
d701c0d -
Update README.md
78e5721 -
Update README.md
a28dcd7 -
Update README.md
f22f79f
-
Update README.md
729c0e2 -
Update README.md
775d531 -
Update README.md
5040d41 -
Delete tokenizer_config.json
7b983f4 -
Delete vocab.json
f31c113 -
Delete chinese_vocab.vocab
15100ff -
Delete spiece.model
82efe68 -
Delete special_tokens_map.json
471c7c1 -
Upload chinese_vocab.vocab
04d2d3e -
Upload vocab.json
e9553c5 -
Update README.md
1c91b86 -
Delete vocab.txt
462d65e -
Update README.md
714370f -
Upload vocab.txt
129a94b -
Upload 3 files
ec5638a -
Update README.md
329c438 -
Upload chinese_vocab.model
e650611 -
Upload chinese_vocab.model
c2ee899 -
Update README.md
6ea41df -
Update README.md
842737b -
Update README.md
8c1f364