Text Generation
Transformers
Safetensors
English
Korean
solar_open
upstage
solar
Mixture of Experts
100b
llm
conversational
Instructions to use upstage/Solar-Open-100B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use upstage/Solar-Open-100B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="upstage/Solar-Open-100B") 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("upstage/Solar-Open-100B") model = AutoModelForCausalLM.from_pretrained("upstage/Solar-Open-100B", 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use upstage/Solar-Open-100B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "upstage/Solar-Open-100B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "upstage/Solar-Open-100B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/upstage/Solar-Open-100B
- SGLang
How to use upstage/Solar-Open-100B 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 "upstage/Solar-Open-100B" \ --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": "upstage/Solar-Open-100B", "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 "upstage/Solar-Open-100B" \ --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": "upstage/Solar-Open-100B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use upstage/Solar-Open-100B with Docker Model Runner:
docker model run hf.co/upstage/Solar-Open-100B
Chat template: look up tool names in one pass
#27
by vMaroon - opened
- chat_template.jinja +39 -1
chat_template.jinja
CHANGED
|
@@ -103,6 +103,41 @@
|
|
| 103 |
{{- "<|end|>" }}
|
| 104 |
{%- endif -%}
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
{#- ======== Render main messages ======== #}
|
| 107 |
{%- for message in messages -%}
|
| 108 |
{%- if message.role == 'user' -%}
|
|
@@ -114,7 +149,10 @@
|
|
| 114 |
{{- "<|begin|>tool<|tool_response|>" }}
|
| 115 |
{%- endif -%}
|
| 116 |
{{- "<|tool_response:begin|>" + message.tool_call_id + "<|tool_response:name|>" }}
|
| 117 |
-
{
|
|
|
|
|
|
|
|
|
|
| 118 |
{{- "<|tool_response:result|>" }}
|
| 119 |
{{- message.content }}
|
| 120 |
{{- "<|tool_response:end|>" }}
|
|
|
|
| 103 |
{{- "<|end|>" }}
|
| 104 |
{%- endif -%}
|
| 105 |
|
| 106 |
+
{#- tool_hits: one entry per tool message with a string tool_call_id, in message order: the assistant tool calls
|
| 107 |
+
with that id. Tool calls and tool messages are tagged, sorted by id together (stable, so the calls of an id come
|
| 108 |
+
first and keep their order) and paired in one pass. -#}
|
| 109 |
+
{%- set tl = namespace(items=[], n=0) -%}
|
| 110 |
+
{%- for m in messages -%}
|
| 111 |
+
{%- if m.role == 'assistant' and m.tool_calls -%}
|
| 112 |
+
{%- for tc in m.tool_calls -%}
|
| 113 |
+
{%- if tc.id is string -%}
|
| 114 |
+
{%- set tl.items = tl.items + [{'id': tc.id, 'k': -1, 'tc': tc}] -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
{%- endfor -%}
|
| 117 |
+
{%- endif -%}
|
| 118 |
+
{%- endfor -%}
|
| 119 |
+
{%- for m in messages -%}
|
| 120 |
+
{%- if m.role == 'tool' and m.tool_call_id is string -%}
|
| 121 |
+
{%- set tl.items = tl.items + [{'id': m.tool_call_id, 'k': tl.n}] -%}
|
| 122 |
+
{%- set tl.n = tl.n + 1 -%}
|
| 123 |
+
{%- endif -%}
|
| 124 |
+
{%- endfor -%}
|
| 125 |
+
{%- set pr = namespace(id=none, tcs=[], hits=[]) -%}
|
| 126 |
+
{%- for it in tl.items | sort(attribute='id', case_sensitive=true) -%}
|
| 127 |
+
{%- if it.k < 0 -%}
|
| 128 |
+
{%- if pr.id is not none and pr.id == it.id -%}
|
| 129 |
+
{%- set pr.tcs = pr.tcs + [it.tc] -%}
|
| 130 |
+
{%- else -%}
|
| 131 |
+
{%- set pr.id = it.id -%}
|
| 132 |
+
{%- set pr.tcs = [it.tc] -%}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
{%- else -%}
|
| 135 |
+
{%- set pr.hits = pr.hits + [{'k': it.k, 'tcs': pr.tcs if pr.id is not none and pr.id == it.id else []}] -%}
|
| 136 |
+
{%- endif -%}
|
| 137 |
+
{%- endfor -%}
|
| 138 |
+
{%- set tool_hits = pr.hits | sort(attribute='k') -%}
|
| 139 |
+
{%- set tl.n = 0 -%}
|
| 140 |
+
|
| 141 |
{#- ======== Render main messages ======== #}
|
| 142 |
{%- for message in messages -%}
|
| 143 |
{%- if message.role == 'user' -%}
|
|
|
|
| 149 |
{{- "<|begin|>tool<|tool_response|>" }}
|
| 150 |
{%- endif -%}
|
| 151 |
{{- "<|tool_response:begin|>" + message.tool_call_id + "<|tool_response:name|>" }}
|
| 152 |
+
{%- for tc in tool_hits[tl.n].tcs -%}
|
| 153 |
+
{{- tc.function.name }}
|
| 154 |
+
{%- endfor -%}
|
| 155 |
+
{%- set tl.n = tl.n + 1 -%}
|
| 156 |
{{- "<|tool_response:result|>" }}
|
| 157 |
{{- message.content }}
|
| 158 |
{{- "<|tool_response:end|>" }}
|