Instructions to use sail/Sailor-7B-Chat-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use sail/Sailor-7B-Chat-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="sail/Sailor-7B-Chat-gguf", filename="ggml-model-Q2_K.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use sail/Sailor-7B-Chat-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sail/Sailor-7B-Chat-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf sail/Sailor-7B-Chat-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf sail/Sailor-7B-Chat-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf sail/Sailor-7B-Chat-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf sail/Sailor-7B-Chat-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf sail/Sailor-7B-Chat-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf sail/Sailor-7B-Chat-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf sail/Sailor-7B-Chat-gguf:Q4_K_M
Use Docker
docker model run hf.co/sail/Sailor-7B-Chat-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use sail/Sailor-7B-Chat-gguf with Ollama:
ollama run hf.co/sail/Sailor-7B-Chat-gguf:Q4_K_M
- Unsloth Studio new
How to use sail/Sailor-7B-Chat-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sail/Sailor-7B-Chat-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for sail/Sailor-7B-Chat-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for sail/Sailor-7B-Chat-gguf to start chatting
- Docker Model Runner
How to use sail/Sailor-7B-Chat-gguf with Docker Model Runner:
docker model run hf.co/sail/Sailor-7B-Chat-gguf:Q4_K_M
- Lemonade
How to use sail/Sailor-7B-Chat-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull sail/Sailor-7B-Chat-gguf:Q4_K_M
Run and chat with the model
lemonade run user.Sailor-7B-Chat-gguf-Q4_K_M
List all available models
lemonade list
Sailor is a suite of Open Language Models tailored for South-East Asia (SEA), focusing on languages such as 🇮🇩Indonesian, 🇹🇭Thai, 🇻🇳Vietnamese, 🇲🇾Malay, and 🇱🇦Lao. Developed with careful data curation, Sailor models are designed to understand and generate text across diverse linguistic landscapes of SEA region. Built from Qwen 1.5 , Sailor encompasses models of varying sizes, spanning from 0.5B to 14B versions for different requirements. We further fine-tune the base model with open-source datasets to get instruction-tuned models, namedly Sailor-Chat. Benchmarking results demonstrate Sailor's proficiency in tasks such as question answering, commonsense reasoning, and other tasks in SEA languages.
The logo was generated by MidJourney
Model Summary
- Model Collections: Base Model & Chat Model
- Project Website: sea-sailor.github.io/blog/sailor1/
- Codebase: github.com/sail-sg/sailor-llm
- Technical Report: arxiv.org/pdf/2404.03608.pdf
Training details
Sailor is crafted by continually pre-training from language models like the remarkable Qwen 1.5 models, which already has a great performance on SEA languages. The pre-training corpus heavily leverages the publicly available corpus, including SlimPajama, SkyPile, CC100 and MADLAD-400. The instruction tuning corpus are all publicly available including aya_collection, aya_dataset, OpenOrca.
By employing aggressive data deduplication and careful data cleaning on the collected corpus, we have attained a high-quality dataset spanning various languages. Through systematic experiments to determine the weights of different languages, Sailor models undergo training from 200B to 400B tokens, tailored to different model sizes. The approach boosts their performance on SEA languages while maintaining proficiency in English and Chinese without significant compromise. Finally, we continually pre-train the Qwen1.5-0.5B model with 400 Billion tokens, and other models with 200 Billion tokens to obtain the Sailor models.
GGUF model list
| Name | Quant method | Bits | Size | Use case |
|---|---|---|---|---|
| ggml-model-Q2_K.gguf | Q2_K | 2 | 3.10 GB | medium, significant quality loss |
| ggml-model-Q3_K_L.gguf | Q3_K_L | 3 | 4.22 GB | large, substantial quality loss |
| ggml-model-Q3_K_M.gguf | Q3_K_M | 3 | 3.92 GB | medium, balanced quality |
| ggml-model-Q3_K_S.gguf | Q3_K_S | 3 | 3.57 GB | medium, high quality loss |
| ggml-model-Q4_K_M.gguf | Q4_K_M | 4 | 4.77 GB | large, balanced quality |
| ggml-model-Q4_K_S.gguf | Q4_K_S | 4 | 4.54 GB | large, greater quality loss |
| ggml-model-Q5_K_M.gguf | Q5_K_M | 5 | 5.53 GB | large, balanced quality |
| ggml-model-Q5_K_S.gguf | Q5_K_S | 5 | 5.4 GB | large, very low quality loss |
| ggml-model-Q6_K.gguf | Q6_K | 6 | 6.34 GB | large, extremely low quality loss |
| ggml-model-Q8_0.gguf | Q8_0 | 8 | 8.21 GB | very large, extremely low quality loss |
| ggml-model-f16.gguf | f16 | 16 | 15.40 GB | very large, no quality loss |
How to run with llama.cpp
# install llama.cpp
git clone https://github.com/ggerganov/llama.cpp.git
cd llama.cpp
make
pip install -r requirements.txt
# generate with llama.cpp
./main -ngl 32 -m ggml-model-Q4_K_M.gguf -p "<|im_start|>question\nCara memanggang ikan?\n<|im_start|>answer\n" --temp 0.7 --repeat_penalty 1.1 -n 400 -e
Change
-ngl 32to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
How to run with llama-cpp-python
pip install llama-cpp-python
import llama_cpp
import llama_cpp.llama_tokenizer
# load model
llama = llama_cpp.Llama.from_pretrained(
repo_id="sail/Sailor-4B-Chat-gguf",
filename="ggml-model-Q4_K_M.gguf",
tokenizer=llama_cpp.llama_tokenizer.LlamaHFTokenizer.from_pretrained("sail/Sailor-4B-Chat"),
n_gpu_layers=40,
n_threads=8,
verbose=False,
)
system_role= 'system'
user_role = 'question'
assistant_role = "answer"
system_prompt= \
'You are an AI assistant named Sailor created by Sea AI Lab. \
Your answer should be friendly, unbiased, faithful, informative and detailed.'
system_prompt = f"<|im_start|>{system_role}\n{system_prompt}<|im_end|>"
# inference example
output = llama(
system_prompt + '\n' + f"<|im_start|>{user_role}\nCara memanggang ikan?\n<|im_start|>{assistant_role}\n",
max_tokens=256,
temperature=0.7,
top_p=0.75,
top_k=60,
stop=["<|im_end|>", "<|endoftext|>"]
)
print(output['choices'][0]['text'])
How to build demo
Install llama-cpp-python and gradio, then run script.
License
Sailor is distributed under the terms of the Apache License 2.0. No restrict on the research and the commercial use, but should comply with the Qwen License.
Citation
If you find sailor useful, please cite our work as follows:
@inproceedings{dou-etal-2024-sailor,
title = "Sailor: Open Language Models for South-{E}ast {A}sia",
author = "Dou, Longxu and Liu, Qian and Zeng, Guangtao and Guo, Jia and Zhou, Jiahui and Mao, Xin and Jin, Ziqi and Lu, Wei and Lin, Min",
booktitle = "Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demonstrations",
year = "2024",
}
Contact Us
If you have any questions, please raise an issue or contact us at doulx@sea.com or liuqian.sea@gmail.com.
- Downloads last month
- 300
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit