Text Generation
Transformers
Safetensors
English
Korean
Japanese
trillion
finetuned
chat
conversational
custom_code
Instructions to use trillionlabs/Tri-70B-preview-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trillionlabs/Tri-70B-preview-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="trillionlabs/Tri-70B-preview-SFT", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("trillionlabs/Tri-70B-preview-SFT", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use trillionlabs/Tri-70B-preview-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trillionlabs/Tri-70B-preview-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trillionlabs/Tri-70B-preview-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/trillionlabs/Tri-70B-preview-SFT
- SGLang
How to use trillionlabs/Tri-70B-preview-SFT 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 "trillionlabs/Tri-70B-preview-SFT" \ --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": "trillionlabs/Tri-70B-preview-SFT", "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 "trillionlabs/Tri-70B-preview-SFT" \ --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": "trillionlabs/Tri-70B-preview-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use trillionlabs/Tri-70B-preview-SFT with Docker Model Runner:
docker model run hf.co/trillionlabs/Tri-70B-preview-SFT
Update configuration_trillion.py
Browse files
configuration_trillion.py
CHANGED
|
@@ -174,6 +174,7 @@ class TrillionConfig(PretrainedConfig):
|
|
| 174 |
rope_scaling=None,
|
| 175 |
global_attention_freq=4,
|
| 176 |
attn_temperature_tuning=True,
|
|
|
|
| 177 |
floor_scale=1.0,
|
| 178 |
attn_scale=1.0,
|
| 179 |
attention_bias=False,
|
|
@@ -183,6 +184,7 @@ class TrillionConfig(PretrainedConfig):
|
|
| 183 |
**kwargs,
|
| 184 |
):
|
| 185 |
self.attn_temperature_tuning = attn_temperature_tuning
|
|
|
|
| 186 |
self.attn_scale = attn_scale
|
| 187 |
self.floor_scale = floor_scale
|
| 188 |
self.global_attention_freq = global_attention_freq
|
|
@@ -215,6 +217,10 @@ class TrillionConfig(PretrainedConfig):
|
|
| 215 |
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
| 216 |
rope_config_validation(self)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
super().__init__(
|
| 219 |
pad_token_id=pad_token_id,
|
| 220 |
bos_token_id=bos_token_id,
|
|
|
|
| 174 |
rope_scaling=None,
|
| 175 |
global_attention_freq=4,
|
| 176 |
attn_temperature_tuning=True,
|
| 177 |
+
sliding_window=4096,
|
| 178 |
floor_scale=1.0,
|
| 179 |
attn_scale=1.0,
|
| 180 |
attention_bias=False,
|
|
|
|
| 184 |
**kwargs,
|
| 185 |
):
|
| 186 |
self.attn_temperature_tuning = attn_temperature_tuning
|
| 187 |
+
self.sliding_window = sliding_window
|
| 188 |
self.attn_scale = attn_scale
|
| 189 |
self.floor_scale = floor_scale
|
| 190 |
self.global_attention_freq = global_attention_freq
|
|
|
|
| 217 |
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
| 218 |
rope_config_validation(self)
|
| 219 |
|
| 220 |
+
self.layer_types = [
|
| 221 |
+
"sliding_attention" if bool((i + 1) % self.global_attention_freq) else "full_attention" for i in range(self.num_hidden_layers)
|
| 222 |
+
]
|
| 223 |
+
|
| 224 |
super().__init__(
|
| 225 |
pad_token_id=pad_token_id,
|
| 226 |
bos_token_id=bos_token_id,
|