Text Generation
Transformers
Safetensors
mistral
Merge
mergekit
lazymergekit
SeaLLMs/SeaLLM-7B-v2
conversational
text-generation-inference
Instructions to use JSpergel/SailingLLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JSpergel/SailingLLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JSpergel/SailingLLM") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("JSpergel/SailingLLM") model = AutoModelForCausalLM.from_pretrained("JSpergel/SailingLLM") 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use JSpergel/SailingLLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JSpergel/SailingLLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JSpergel/SailingLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/JSpergel/SailingLLM
- SGLang
How to use JSpergel/SailingLLM 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 "JSpergel/SailingLLM" \ --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": "JSpergel/SailingLLM", "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 "JSpergel/SailingLLM" \ --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": "JSpergel/SailingLLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use JSpergel/SailingLLM with Docker Model Runner:
docker model run hf.co/JSpergel/SailingLLM
Upload folder using huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- merge
|
| 4 |
+
- mergekit
|
| 5 |
+
- lazymergekit
|
| 6 |
+
- sail/Sailor-7B
|
| 7 |
+
- SeaLLMs/SeaLLM-7B-v2
|
| 8 |
+
base_model:
|
| 9 |
+
- sail/Sailor-7B
|
| 10 |
+
- SeaLLMs/SeaLLM-7B-v2
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# SailingLLM
|
| 14 |
+
|
| 15 |
+
SailingLLM is a merge of the following models using [LazyMergekit](https://colab.research.google.com/drive/1obulZ1ROXHjYLn6PPZJwRR6GzgQogxxb?usp=sharing):
|
| 16 |
+
* [sail/Sailor-7B](https://huggingface.co/sail/Sailor-7B)
|
| 17 |
+
* [SeaLLMs/SeaLLM-7B-v2](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2)
|
| 18 |
+
|
| 19 |
+
## 🧩 Configuration
|
| 20 |
+
|
| 21 |
+
```yaml
|
| 22 |
+
slices:
|
| 23 |
+
- sources:
|
| 24 |
+
- model: sail/Sailor-7B
|
| 25 |
+
layer_range: [0, 32]
|
| 26 |
+
- model: SeaLLMs/SeaLLM-7B-v2
|
| 27 |
+
layer_range: [0, 32]
|
| 28 |
+
merge_method: slerp
|
| 29 |
+
base_model: sail/Sailor-7B
|
| 30 |
+
parameters:
|
| 31 |
+
t:
|
| 32 |
+
- filter: self_attn
|
| 33 |
+
value: [0, 0.5, 0.3, 0.7, 1]
|
| 34 |
+
- filter: mlp
|
| 35 |
+
value: [1, 0.5, 0.7, 0.3, 0]
|
| 36 |
+
- value: 0.5
|
| 37 |
+
dtype: bfloat16
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## 💻 Usage
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
!pip install -qU transformers accelerate
|
| 44 |
+
|
| 45 |
+
from transformers import AutoTokenizer
|
| 46 |
+
import transformers
|
| 47 |
+
import torch
|
| 48 |
+
|
| 49 |
+
model = "JSpergel/SailingLLM"
|
| 50 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
| 51 |
+
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 53 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 54 |
+
pipeline = transformers.pipeline(
|
| 55 |
+
"text-generation",
|
| 56 |
+
model=model,
|
| 57 |
+
torch_dtype=torch.float16,
|
| 58 |
+
device_map="auto",
|
| 59 |
+
)
|
| 60 |
+
|
| 61 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 62 |
+
print(outputs[0]["generated_text"])
|
| 63 |
+
```
|