Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
conversational
text-generation-inference
Instructions to use sail/Sailor2-8B-Pre with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor2-8B-Pre with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor2-8B-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-8B-Pre") model = AutoModelForCausalLM.from_pretrained("sail/Sailor2-8B-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-8B-Pre with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor2-8B-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-8B-Pre", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor2-8B-Pre
- SGLang
How to use sail/Sailor2-8B-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-8B-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-8B-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-8B-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-8B-Pre", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor2-8B-Pre with Docker Model Runner:
docker model run hf.co/sail/Sailor2-8B-Pre
Commit History
-
Update README.md
Verified signaturef9112a4
-
Upload sailor2_banner.jpg
Verified signature1ddb1ca -
Create README.md
Verified signature8c8620f
-
Upload folder using huggingface_hub (#1)
Verified signature- d11639c3ec802c5e35e65b1f58b32daf1b71567a73037fca19f5c90890b58152 (d7c2b16417967a1f9afac121cc10efdef75ecebc) - 825dbf70d904896ed97db8af8c379e7179dad62ffeaac11971db784932414db8 (f703dc493a7400f73144f958abe9072113e32583) - 67351bea39454636a8094330d1c9c2d8c748f2b9e262d2bc1c2e490f828108c5 (74519de636a1b357622f4c75982c942f86660e1a) - 7630e3041fee76ac710da180f5b2555a48dbb454e1247ba97ac6786e66291b35 (7af99f75df8c0248a4127bfbf34aeea7536f6075)b437791 -
initial commit
Verified signaturecc0516f