Text Generation
Transformers
Safetensors
afmoe
reasoning
agentic
tool-calling
thinking
conversational
custom_code
Eval Results
Instructions to use arcee-ai/Trinity-Large-Thinking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use arcee-ai/Trinity-Large-Thinking with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="arcee-ai/Trinity-Large-Thinking", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("arcee-ai/Trinity-Large-Thinking", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("arcee-ai/Trinity-Large-Thinking", trust_remote_code=True) 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use arcee-ai/Trinity-Large-Thinking with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "arcee-ai/Trinity-Large-Thinking" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "arcee-ai/Trinity-Large-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/arcee-ai/Trinity-Large-Thinking
- SGLang
How to use arcee-ai/Trinity-Large-Thinking 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 "arcee-ai/Trinity-Large-Thinking" \ --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": "arcee-ai/Trinity-Large-Thinking", "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 "arcee-ai/Trinity-Large-Thinking" \ --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": "arcee-ai/Trinity-Large-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use arcee-ai/Trinity-Large-Thinking with Docker Model Runner:
docker model run hf.co/arcee-ai/Trinity-Large-Thinking
add python codes to code blocks
Browse files
README.md
CHANGED
|
@@ -173,39 +173,41 @@ This configuration:
|
|
| 173 |
|
| 174 |
**Extracting reasoning content from the API response:**
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
|
| 198 |
}
|
| 199 |
}
|
| 200 |
-
|
| 201 |
-
|
|
|
|
| 202 |
|
| 203 |
-
|
| 204 |
-
|
| 205 |
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
| 209 |
|
| 210 |
**Note on thinking-in-context with vLLM**: When building multi-turn agentic loops, include both `reasoning_content` and `content` in the conversation history you send back to the model. The reasoning content should be re-wrapped in `<think>...</think>` tags within the assistant message.
|
| 211 |
|
|
@@ -213,40 +215,41 @@ This configuration:
|
|
| 213 |
|
| 214 |
Use the `main` transformers branch or pass `trust_remote_code=True` with a released version.
|
| 215 |
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
|
|
|
| 250 |
|
| 251 |
### API
|
| 252 |
|
|
|
|
| 173 |
|
| 174 |
**Extracting reasoning content from the API response:**
|
| 175 |
|
| 176 |
+
```python
|
| 177 |
+
from openai import OpenAI
|
| 178 |
+
|
| 179 |
+
client = OpenAI(api_key="EMPTY", base_url="http://localhost:8000/v1")
|
| 180 |
+
|
| 181 |
+
response = client.chat.completions.create(
|
| 182 |
+
model="arcee-ai/Trinity-Large-Thinking",
|
| 183 |
+
messages=[
|
| 184 |
+
{"role": "user", "content": "What's the weather like in Paris?"}
|
| 185 |
+
],
|
| 186 |
+
tools=[ # your tool definitions here
|
| 187 |
+
{
|
| 188 |
+
"type": "function",
|
| 189 |
+
"function": {
|
| 190 |
+
"name": "get_weather",
|
| 191 |
+
"description": "Get current weather for a location",
|
| 192 |
+
"parameters": {
|
| 193 |
+
"type": "object",
|
| 194 |
+
"properties": {
|
| 195 |
+
"location": {"type": "string"}
|
| 196 |
+
},
|
| 197 |
+
"required": ["location"]
|
| 198 |
}
|
| 199 |
}
|
| 200 |
+
}
|
| 201 |
+
],
|
| 202 |
+
)
|
| 203 |
|
| 204 |
+
# Access reasoning (thinking) content
|
| 205 |
+
reasoning = response.choices[0].message.reasoning_content
|
| 206 |
|
| 207 |
+
# Access final response or tool calls
|
| 208 |
+
content = response.choices[0].message.content
|
| 209 |
+
tool_calls = response.choices[0].message.tool_calls
|
| 210 |
+
```
|
| 211 |
|
| 212 |
**Note on thinking-in-context with vLLM**: When building multi-turn agentic loops, include both `reasoning_content` and `content` in the conversation history you send back to the model. The reasoning content should be re-wrapped in `<think>...</think>` tags within the assistant message.
|
| 213 |
|
|
|
|
| 215 |
|
| 216 |
Use the `main` transformers branch or pass `trust_remote_code=True` with a released version.
|
| 217 |
|
| 218 |
+
```python
|
| 219 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 220 |
+
import torch
|
| 221 |
+
|
| 222 |
+
model_id = "arcee-ai/Trinity-Large-Thinking"
|
| 223 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 224 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 225 |
+
model_id,
|
| 226 |
+
torch_dtype=torch.bfloat16,
|
| 227 |
+
device_map="auto",
|
| 228 |
+
trust_remote_code=True
|
| 229 |
+
)
|
| 230 |
+
|
| 231 |
+
messages = [
|
| 232 |
+
{"role": "user", "content": "Who are you?"},
|
| 233 |
+
]
|
| 234 |
+
|
| 235 |
+
input_ids = tokenizer.apply_chat_template(
|
| 236 |
+
messages,
|
| 237 |
+
add_generation_prompt=True,
|
| 238 |
+
return_tensors="pt"
|
| 239 |
+
).to(model.device)
|
| 240 |
+
|
| 241 |
+
outputs = model.generate(
|
| 242 |
+
input_ids,
|
| 243 |
+
max_new_tokens=4096,
|
| 244 |
+
do_sample=True,
|
| 245 |
+
temperature=0.6,
|
| 246 |
+
top_k=50,
|
| 247 |
+
top_p=0.95
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 251 |
+
print(response)
|
| 252 |
+
```
|
| 253 |
|
| 254 |
### API
|
| 255 |
|