Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
conversational
text-generation-inference
Instructions to use sail/Sailor2-L-20B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-L-20B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-L-20B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sail/Sailor2-L-20B") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-L-20B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sail/Sailor2-L-20B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor2-L-20B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sail/Sailor2-L-20B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-L-20B
- SGLang
How to use sail/Sailor2-L-20B 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 "sail/Sailor2-L-20B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sail/Sailor2-L-20B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "sail/Sailor2-L-20B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sail/Sailor2-L-20B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-L-20B with Docker Model Runner:
docker model run hf.co/sail/Sailor2-L-20B
Commit History
-
Upload folder using huggingface_hub (#1)
Verified signature- d246a8f52b8898a25f050cddd494d81b343f95c1f03c03a5ce88c0076784e423 (1cb31037d33d4317461f927bfd27100f474c96b4) - 3a4685d4e796a6d19aeecfa8b919d7690f9cec43c20f3c19fc77ba6f2528a3d1 (23eb004778a77aa0be8cab20a47151b68d4e023d) - e7612d00267c43c25f603eb3b5262239e96d1b964a96692dd5b392d7440d652b (f05c7d035c9125f57d703ef7465dad3164e5df53) - 3b606025c9e6f637ae307879f39c2d4cd5502070f298a68b1bfae4f28f38aa0f (1b6cbfff38bfdb26a0d7d92c3e3c5c26fe073fdd) - b770bd3b38bc630f5ff919dfe6455cc730256ec5c62ea1d7a35929ff0018a8d4 (baa53386a9372877ad73c5527876a8d262959fcb) - dbbfbf2818f3f3e8a053bbd6cdd4b2f5f53b8d6ac8ec52ea916555d90ae16a8e (2407d6e330f6c7c22aeadf421aa90dc71eca189c) - 19cd9ad87b0c73b3f50c43cf74f505b4f59bf4131b462b01601ef494157445de (9e479e18280a5d86994ae401677505b973ec279a) - b37645962cf3141583e14419140ee1ebfa0ce5dcaa29bdac8806fb531912980e (f3657742c6b51659bfda9c69e36038c4cf3d0f2f) - ffd4d958264cf8a3349d8200b2c2180190ec0fb20ef04583547d70fd4154eb3d (d356650c0bf496c0f870d5d5702a57768a36fc35)94c56c0