Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
conversational
text-generation-inference
Instructions to use sail/Sailor2-20B-Pre with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-20B-Pre with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-20B-Pre") 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-Pre") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-20B-Pre", 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-Pre with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor2-20B-Pre" # 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-Pre", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-20B-Pre
- SGLang
How to use sail/Sailor2-20B-Pre 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-Pre" \ --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-Pre", "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-Pre" \ --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-Pre", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-20B-Pre with Docker Model Runner:
docker model run hf.co/sail/Sailor2-20B-Pre
Commit History
-
Upload folder using huggingface_hub (#2)
Verified signature- b7b87db02da2a65527b60dbc75eee5785feff5bcf11e109a98ea62fa5c6be900 (96c2fd288fd62b115dfd5805cfdf8ec27c36db7e) - 3ec988b38f22954b3ced12c7ab4996cb8049698603ac56d703bf79e7aad7fc9e (422f4794aa6922669c6cb9e8a2886d4eba8897d2) - c2baa6983129e0f7d7aa7186d0ca39cf62beba2e445e871ae2d30b9280d129e0 (5bea021141ecf0c852d871cab5547e99e24c8cf5) - ee4b1720f9279a04f914deddf5119d474a1f5dbb70ada27d1555b65fafba4aea (5992c30235b2138f8b724dc4f75769e5a471d04b) - e015e1371d3dba909def90371dbdf29eb4872beb2431227e3cd745aaf8f411e1 (e372b7ecaf37909621afebb54ee0dbb7004b9ff9) - 6f9bb71c0e35edc05ed73a301b593bff72c9d397b3912c6116465296c3a7d2e8 (48a20aa68329b496b916d52c3a71ae5d64334035) - ad1bb0e431ad6acd554d73509642857a907e370a6fbdfedf5eadd882bb974185 (0b3f6d56567d664d1d6202de75cb1e03c622cdd5) - d92850bb5f9289be13833608081a73cc31f73965fc275f5acce869e063bf5910 (7afc66306969b3867d8d34ebdf651c4a12884bc2) - 609fd0d01ee217b0a7171245124cb231a7c77a216c69f674ab28cc04ec48316f (5c4c00d22794dc1aa1acc3542045d65b926d7b89) - 457f3ad6…f76902c