Instructions to use stabilityai/stablelm-2-12b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use stabilityai/stablelm-2-12b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="stabilityai/stablelm-2-12b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablelm-2-12b") model = AutoModelForCausalLM.from_pretrained("stabilityai/stablelm-2-12b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use stabilityai/stablelm-2-12b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "stabilityai/stablelm-2-12b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "stabilityai/stablelm-2-12b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/stabilityai/stablelm-2-12b
- SGLang
How to use stabilityai/stablelm-2-12b 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 "stabilityai/stablelm-2-12b" \ --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": "stabilityai/stablelm-2-12b", "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 "stabilityai/stablelm-2-12b" \ --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": "stabilityai/stablelm-2-12b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use stabilityai/stablelm-2-12b with Docker Model Runner:
docker model run hf.co/stabilityai/stablelm-2-12b
Commit History
-
Update README.md
Verified signature74dd3f5 -
Update README.md
Verified signature43f0c4c -
Update README.md
Verified signature8750c37 -
Rename LICENSE to LICENSE.md
Verified signature0c60055
-
warn(README.md): bold
Verified signaturefead13d -
warn(README): `transformers>=4.40.0` dependency
Verified signature9d693cd
-
Merge branch 'main' of https://huggingface.co/stabilityai/stablelm-2-12b into main
37e38dc -
bump(transformers): use upstream implementation
2aa2607
-
Update README.md
Verified signaturec934d66
-
tmpfix(tokenizer_config): force `GPT2TokenizerFast`
Verified signature00e549c
-
Update README.md
Verified signaturec4e0a2b -
update(README): add citation
d49f6a2
-
Create LICENSE
Verified signature4d4accb
-
tmp: use `trust_remote_code=True` flag
9d6f9e2 -
fix: set pad token id in gen config
15e5677
-
feat: add tokenizer for `stablelm-2-12b`
20dc021 -
feat: add base weights for `stablelm-2-12b`
Verified signature0225bfd
-
initial commit
b42bea9