Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
sft
chat
instruction
conversational
text-generation-inference
Instructions to use sail/Sailor2-20B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-20B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-20B-Chat") 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-20B-Chat") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-20B-Chat", 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-20B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor2-20B-Chat" # 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-20B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-20B-Chat
- SGLang
How to use sail/Sailor2-20B-Chat 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-20B-Chat" \ --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-20B-Chat", "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-20B-Chat" \ --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-20B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-20B-Chat with Docker Model Runner:
docker model run hf.co/sail/Sailor2-20B-Chat
Commit History
-
Upload folder using huggingface_hub (#1)
Verified signature- 3683cda03502bf581e6749b3e817d551e5088e8d77424e74bc824b6bf97ce6cc (26862b4be71a8dabd043a32f4ad226e9bd535091) - dbc90a0b0c0dc6a633e08dbf01b569104698b279c9eb63dd12fdf1917e2290f5 (70e11452d4a4dd93550c7f68f64a9b70fb2d33d3) - c7169915a847f169ba0566aca0f64dfa11ac6f64b7a26b3e04f571909a8961e3 (4034659aa27e6fa5effd32597fd55b6b4db1581f) - 0f76a120cbfffe6e9da691210dbaa7290632647ab052da577abd68caafe9a547 (3a7e1ee3944181819a236b50545a63e598bcf89e) - 4b759b95e4af351b197175748427b933bce5a42c0b44706ec0733a2fd746f0d4 (593fbca9755da2761d624fedfd47a6fb73ea3923) - 3e4176d8e0951085ffa9e539d1865b635665f485a43b63ab2e2674474c8c816c (774599a5d5ad8557c7a994f12c4a6997dbb4eef1) - 90a80471a99311f6e6f4537ecb75e323d1618a989b568b7ead2ab52edc3c7ace (9660b9d1332d0c07d895f03c582b7516d2df7d79) - 633d92a2e5844d662e10471fc426ccb7c0fcccd3b60f4512e9e6daef075ed4f5 (77955c025f19ffa6d027abb0c1c24ae9dc0aef26) - c4339557b171baf23585fa2e7d27f2fc0aef8e082c7c9622642614a6fcf50fa8 (8832cc3b2017f5a887acf3945e2394520cc99071)3fdf14e