Text Generation
Transformers
Safetensors
qwen2
multilingual
sea
sailor
sft
chat
instruction
conversational
text-generation-inference
Instructions to use sail/Sailor-4B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sail/Sailor-4B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sail/Sailor-4B-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/Sailor-4B-Chat") model = AutoModelForCausalLM.from_pretrained("sail/Sailor-4B-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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sail/Sailor-4B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sail/Sailor-4B-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/Sailor-4B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sail/Sailor-4B-Chat
- SGLang
How to use sail/Sailor-4B-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/Sailor-4B-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/Sailor-4B-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/Sailor-4B-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/Sailor-4B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sail/Sailor-4B-Chat with Docker Model Runner:
docker model run hf.co/sail/Sailor-4B-Chat
Update README.md
Browse filesAdd examples in different languages
README.md
CHANGED
|
@@ -8,10 +8,6 @@ language:
|
|
| 8 |
- ms
|
| 9 |
- lo
|
| 10 |
datasets:
|
| 11 |
-
- cerebras/SlimPajama-627B
|
| 12 |
-
- Skywork/SkyPile-150B
|
| 13 |
-
- allenai/MADLAD-400
|
| 14 |
-
- cc100
|
| 15 |
- CohereForAI/aya_dataset
|
| 16 |
- CohereForAI/aya_collection
|
| 17 |
- Open-Orca/OpenOrca
|
|
@@ -22,6 +18,19 @@ tags:
|
|
| 22 |
- sft
|
| 23 |
- chat
|
| 24 |
- instruction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
license: apache-2.0
|
| 26 |
base_model: sail/Sailor-4B
|
| 27 |
---
|
|
|
|
| 8 |
- ms
|
| 9 |
- lo
|
| 10 |
datasets:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
- CohereForAI/aya_dataset
|
| 12 |
- CohereForAI/aya_collection
|
| 13 |
- Open-Orca/OpenOrca
|
|
|
|
| 18 |
- sft
|
| 19 |
- chat
|
| 20 |
- instruction
|
| 21 |
+
widget:
|
| 22 |
+
- text: "如何制作烤鱼?"
|
| 23 |
+
example_title: "Chinese"
|
| 24 |
+
- text: "How to bake fish?"
|
| 25 |
+
example_title: "English"
|
| 26 |
+
- text: "Bagaimana cara memanggang ikan?"
|
| 27 |
+
example_title: "Malay"
|
| 28 |
+
- text: "วิธีย่างปลา?"
|
| 29 |
+
example_title: "Thai"
|
| 30 |
+
- text: "Bagaimana membuat bakaran ikan?"
|
| 31 |
+
example_title: "Indonesian"
|
| 32 |
+
- text: "Làm thế nào để nướng cá?"
|
| 33 |
+
example_title: "Vietnamese"
|
| 34 |
license: apache-2.0
|
| 35 |
base_model: sail/Sailor-4B
|
| 36 |
---
|