Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
conversational
text-generation-inference
Instructions to use sail/Sailor2-20B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-20B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-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-20B") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-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-20B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor2-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-20B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-20B
- SGLang
How to use sail/Sailor2-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-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-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-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-20B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-20B with Docker Model Runner:
docker model run hf.co/sail/Sailor2-20B
Commit History
-
Update README.md
Verified signaturee83f558 -
Improve language tag (#4)
Verified signature- Improve language tag (63cfed972ddb841f184b35f87c9a629478b6b056) Co-authored-by: Loïck BOURDOIS <lbourdois@users.noreply.huggingface.co>98d48c3
-
Update README.md
Verified signaturefa925db
-
Update README.md
Verified signature602735d
-
Update README.md
Verified signature7b2b31b
-
Update config.json
Verified signature3597802
-
Update README.md
Verified signatureab45cc4
-
Update README.md
Verified signature9e8c3d6
-
Update README.md
Verified signaturecb3011b -
Update README.md
Verified signaturef36e8d3 -
Update README.md
Verified signature854a172
-
Update README.md
Verified signature0ef7157 -
Update README.md
Verified signaturef3595d9 -
Create README.md
Verified signaturebc0b129 -
Upload sailor2_banner.jpg
Verified signature2e1e605 -
Upload folder using huggingface_hub (#1)
Verified signature- b7b87db02da2a65527b60dbc75eee5785feff5bcf11e109a98ea62fa5c6be900 (948ed65491d71977bf6f879f527f9d555f456866) - 3ec988b38f22954b3ced12c7ab4996cb8049698603ac56d703bf79e7aad7fc9e (331690cd1e52bf6086bc0dc472c990a6efe6f2a1) - c2baa6983129e0f7d7aa7186d0ca39cf62beba2e445e871ae2d30b9280d129e0 (fd1ff1f2be7a6164d860fec0047040b3ad00e0e7) - ee4b1720f9279a04f914deddf5119d474a1f5dbb70ada27d1555b65fafba4aea (0bf9e0c5426afbd3ff3ed35df1113b8d99e95e12) - e015e1371d3dba909def90371dbdf29eb4872beb2431227e3cd745aaf8f411e1 (804735f09851997d12ee646bdbdb81824816d34a) - 6f9bb71c0e35edc05ed73a301b593bff72c9d397b3912c6116465296c3a7d2e8 (1308ce2158f9b4aca9108ddd22cabf49ce88879d) - ad1bb0e431ad6acd554d73509642857a907e370a6fbdfedf5eadd882bb974185 (c5529ed981cec06046cee59738fa9edf81e841af) - d92850bb5f9289be13833608081a73cc31f73965fc275f5acce869e063bf5910 (c135ca7df215601419bc3a9170cc261f524dfa96) - 609fd0d01ee217b0a7171245124cb231a7c77a216c69f674ab28cc04ec48316f (3cd408f08258712318144edea0db6f19ea44ef64) - a3fd0621…aa14454 -
initial commit
Verified signature7c68c3f