Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
sft
chat
instruction
conversational
text-generation-inference
Instructions to use sail/Sailor2-L-20B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-L-20B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-L-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-L-20B-Chat") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-L-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-L-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-L-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-L-20B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-L-20B-Chat
- SGLang
How to use sail/Sailor2-L-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-L-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-L-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-L-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-L-20B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-L-20B-Chat with Docker Model Runner:
docker model run hf.co/sail/Sailor2-L-20B-Chat
Commit History
-
Upload folder using huggingface_hub (#1)
Verified signature- b92705a222ee70638832f00d72ac6f2253efc16c472b38834bfeec3f0a232ed4 (d63f6b14c808c530aa42bcda483447d7c36f92f9) - f3fcff91b300679012306810d27525353cf14a924f120ca844c735e9d3a7a1df (1be836a4fb5ba3bc3d0a2564fdfc64d2993af79c) - bf909f0a6a9ce07cff500e3ca3f00d82395ddd425a8de43d44a208de3346ac6c (cecc9ca2db3999a19e46cc0882f7905fbf724982) - 0d6857113b9f53b4a399ce15e4cb1a79be6e9906e9927e7311fbcd460dd321c9 (e42841430b7fd403235b28dbb60a7ec585e92391) - c0333737331fea38b5576b284b7c5870d47bb9699e9e4f7137ccbff473e1e273 (e396eeab071258752fb778011be541f9f8fd99bf) - 4624e1dd0601aa4e890f15ac1f2cef02eb72b944b20389bac5a152c2967859c3 (ba5f3a706d061ea369c94a06622f7c39e57882e5) - cb74e758ff9abdb396ea10989c148131f550249b0199af4d2d0b407a12ab9b71 (b4906e1abab5f285c96af30ec184f2f405fc442d) - b9fe8f53cf5f36dea349a5d9391afdca506d6fdb4adeb865b2c89639fdee7bdd (3ea52efccaf6c6e79c3f9c521bc48cbe98b82e0d) - 75fa3b465f8a399c8ff8bb10a7a2adb2fd2513a27c0fbf7b766030c347bfd838 (573cec37d1d2ac58487d383bf8dba3c15ca6e880)df5ed28