@simplexai/localmodels-win32-x64 0.1.0-dev.107 → 0.1.0-dev.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +13 -6
- package/README.md +1 -1
- package/bootstrap.identity +1 -1
- package/bootstrap.sha256 +54 -50
- package/modules/localmodels/__init__.py +1 -1
- package/modules/localmodels/catalog.json +682 -67
- package/modules/localmodels/catalog.py +11 -1
- package/modules/localmodels/catalog_recipes.py +26 -3
- package/modules/localmodels/chat_template.py +6 -0
- package/modules/localmodels/chat_templates/qwen4-35b-a3b.jinja +223 -0
- package/modules/localmodels/debug_stub_server.py +1 -1
- package/modules/localmodels/download-mirrors.json +23 -34
- package/modules/localmodels/engine_adapters/llama_cpp.py +11 -5
- package/modules/localmodels/engine_adapters/strata_poly.py +1 -1
- package/modules/localmodels/engines-b12973.json +248 -0
- package/modules/localmodels/library_cli.py +68 -1
- package/modules/localmodels/library_direct.py +2 -0
- package/modules/localmodels/library_elastic.py +1 -1
- package/modules/localmodels/library_model.py +4 -0
- package/modules/localmodels/library_order.py +44 -1
- package/modules/localmodels/library_presentation.py +1 -0
- package/modules/localmodels/library_pricing.py +1 -2
- package/modules/localmodels/library_unload.py +274 -0
- package/modules/localmodels/probe.py +98 -7
- package/modules/localmodels/service_roots.py +148 -0
- package/modules/localmodels/service_upgrade.py +46 -1
- package/modules/localmodels/services_cli.py +8 -28
- package/modules/localmodels/speech_workers.py +4 -4
- package/modules/localmodels/stack_args.py +11 -4
- package/modules/localmodels/stack_down.py +368 -42
- package/modules/localmodels/stack_memory.py +1 -1
- package/modules/localmodels/stack_preflight.py +2 -2
- package/modules/localmodels/stack_view_llm.py +2 -2
- package/modules/localmodels/suite.py +4 -0
- package/modules/localmodels/tts-moss.txt +78 -53
- package/modules/localmodels/tts_backend_speechcpp.py +2 -2
- package/modules/localmodels/tts_catalog.py +2 -2
- package/modules/localmodels/tts_cli.py +3 -3
- package/modules/localmodels/tts_jobs.py +1 -3
- package/modules/localmodels/tts_model.py +3 -3
- package/modules/localmodels/tts_moss_presets.json +1 -1
- package/modules/localmodels/tts_sidecar.py +7 -3
- package/modules/localmodels/tts_state.py +15 -0
- package/modules/localmodels/tts_worker_kokoro.py +939 -255
- package/modules/localmodels/tts_worker_moss.py +25 -9
- package/modules/localmodels/tts_workers.py +17 -21
- package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/METADATA +1 -1
- package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/RECORD +49 -45
- package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/licenses/NOTICE +13 -6
- package/package.json +1 -1
- package/tool.json +1 -1
- /package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/WHEEL +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/entry_points.txt +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/licenses/LICENSE +0 -0
- /package/modules/{simplex_localmodels-0.1.0.dev107.dist-info → simplex_localmodels-0.1.0.dev109.dist-info}/licenses/localmodels/HERMES-LICENSE +0 -0
|
@@ -159,6 +159,8 @@ class CatalogEntry:
|
|
|
159
159
|
draft_spec: draft_spec.DraftSpec | None = None
|
|
160
160
|
mtp_head: AssetFile | None = None
|
|
161
161
|
sampling: dict[str, str] = field(default_factory=dict)
|
|
162
|
+
# Tensors explicitly kept off GPU and read lazily via --load-mode mmap --lazy-mode on -ot P=CPU.
|
|
163
|
+
lazy_offload_tensors: tuple[str, ...] = ()
|
|
162
164
|
min_engine: str = ""
|
|
163
165
|
chat_template: str = "" # a chat_templates/ file replacing the GGUF's (chat_template.py)
|
|
164
166
|
# Editorial quality ordering (higher = smarter); ranks entries for the recommendation only.
|
|
@@ -233,6 +235,13 @@ class CatalogEntry:
|
|
|
233
235
|
updated = replace(updated, ubatch=min(updated.ubatch, self.ubatch), ubatch_pinned=True)
|
|
234
236
|
return updated
|
|
235
237
|
|
|
238
|
+
def agent_profile(self, variant: QuantVariant) -> ModelProfile:
|
|
239
|
+
"""Profile as the agent posture loads it: lazy tensors stay off device when the entry
|
|
240
|
+
explicitly offloads them (--load-mode mmap --lazy-mode on -ot <pat>=CPU), otherwise
|
|
241
|
+
they count as resident weights."""
|
|
242
|
+
profile = self.profile(variant)
|
|
243
|
+
return profile if self.lazy_offload_tensors and variant.lazy_bytes else eager(profile)
|
|
244
|
+
|
|
236
245
|
def launch_plan(
|
|
237
246
|
self,
|
|
238
247
|
variant: QuantVariant,
|
|
@@ -242,7 +251,7 @@ class CatalogEntry:
|
|
|
242
251
|
) -> LaunchPlan:
|
|
243
252
|
if agent is not None:
|
|
244
253
|
agent = self.agent_posture(agent)
|
|
245
|
-
profile =
|
|
254
|
+
profile = self.agent_profile(variant)
|
|
246
255
|
depth = self.mtp_draft_depth if self.agent_mtp and self.mtp_capable else 0
|
|
247
256
|
planned = vision.priced(self.mmproj, profile, budget, agent, mtp_depth=depth)
|
|
248
257
|
return draft_spec.priced(self.draft_spec, planned, budget, agent)
|
|
@@ -494,6 +503,7 @@ def load_catalog(value: object) -> tuple[CatalogEntry, ...]:
|
|
|
494
503
|
agent_mtp=bool(m.get("agent_mtp", False)),
|
|
495
504
|
n_vocab=m.get("n_vocab", 0),
|
|
496
505
|
sampling=m.get("sampling", {}),
|
|
506
|
+
lazy_offload_tensors=tuple(m.get("lazy_offload_tensors", [])),
|
|
497
507
|
min_engine=m.get("min_engine", ""),
|
|
498
508
|
chat_template=m.get("chat_template", ""),
|
|
499
509
|
quality=quality,
|
|
@@ -18,7 +18,13 @@ FIXTURE_DIR = Path(__file__).with_name("fixtures")
|
|
|
18
18
|
SCHEMA_VERSION = 3
|
|
19
19
|
STATUSES = ("candidate", "validated", "deprecated")
|
|
20
20
|
PLATFORMS = ("linux", "darwin", "win32") # validated_on: Linux, Apple Silicon Macs, Windows
|
|
21
|
-
EFFORT_LEVELS = ("low", "medium", "high") # reasoning_effort values
|
|
21
|
+
EFFORT_LEVELS = ("low", "medium", "high") # default reasoning_effort values when omitted
|
|
22
|
+
ALLOWED_EFFORT_LEVELS = (
|
|
23
|
+
"low",
|
|
24
|
+
"medium",
|
|
25
|
+
"high",
|
|
26
|
+
"xhigh",
|
|
27
|
+
) # valid reasoning_effort values in catalog reasoning_efforts, in order
|
|
22
28
|
TASKS = tuple("llm vision decision embedding reranker stt tts privacy-span".split())
|
|
23
29
|
# Model-card families Linger's LocalModelFamily knows (its contract); "other" for the rest.
|
|
24
30
|
FAMILIES = tuple("qwen gemma llama openai deepseek mistral phi glm kimi claude grok other".split())
|
|
@@ -169,6 +175,7 @@ class OptionalModelData(ModelData, ProvenanceData, CardData, total=False):
|
|
|
169
175
|
agent_mtp: bool
|
|
170
176
|
n_vocab: int
|
|
171
177
|
sampling: dict[str, str]
|
|
178
|
+
lazy_offload_tensors: list[str]
|
|
172
179
|
min_engine: str
|
|
173
180
|
chat_template: str
|
|
174
181
|
quality: int | QualityData
|
|
@@ -367,9 +374,11 @@ def _entry_problems(
|
|
|
367
374
|
found.append("validated_on needs status validated")
|
|
368
375
|
efforts = item.get("reasoning_efforts")
|
|
369
376
|
if efforts is not None and (
|
|
370
|
-
not efforts or list(efforts) != [e for e in
|
|
377
|
+
not efforts or list(efforts) != [e for e in ALLOWED_EFFORT_LEVELS if e in efforts]
|
|
371
378
|
):
|
|
372
|
-
found.append(
|
|
379
|
+
found.append(
|
|
380
|
+
f"reasoning_efforts must list some of {', '.join(ALLOWED_EFFORT_LEVELS)} in order"
|
|
381
|
+
)
|
|
373
382
|
tasks = item.get("tasks") or []
|
|
374
383
|
if any(t not in TASKS for t in tasks):
|
|
375
384
|
found.append("tasks has an unknown task")
|
|
@@ -473,6 +482,20 @@ def problems(value: object) -> list[str]:
|
|
|
473
482
|
issues.append(f"engine lock engines-{tag}.json does not exist")
|
|
474
483
|
if (ub := m.get("ubatch")) is not None and ub <= 0:
|
|
475
484
|
issues.append("ubatch must be positive")
|
|
485
|
+
if (offload := m.get("lazy_offload_tensors")) is not None and (
|
|
486
|
+
not isinstance(offload, list)
|
|
487
|
+
or not offload
|
|
488
|
+
or any(
|
|
489
|
+
not isinstance(pat, str)
|
|
490
|
+
or not pat.strip()
|
|
491
|
+
or "=" in pat
|
|
492
|
+
or any(ch.isspace() for ch in pat)
|
|
493
|
+
for pat in offload
|
|
494
|
+
)
|
|
495
|
+
):
|
|
496
|
+
issues.append(
|
|
497
|
+
"lazy_offload_tensors must be a non-empty list of tensor patterns without '=' or spaces"
|
|
498
|
+
)
|
|
476
499
|
quality = m.get("quality")
|
|
477
500
|
if not isinstance(quality, dict) or not quality["sources"]:
|
|
478
501
|
issues.append("quality has no sources")
|
|
@@ -4,6 +4,12 @@ Qwen3.8-27B's template refuses a system message after the first turn, which Clau
|
|
|
4
4
|
(its "# Environment" block). ``chat_templates/qwen3.8-27b.jinja`` is that template with the one
|
|
5
5
|
``raise_exception`` turned into a system turn (tests/test_chat_template.py pins the original).
|
|
6
6
|
|
|
7
|
+
Qwen4-35B-A3B's embedded template rejects ``reasoning_effort="medium"`` (HTTP 400 under
|
|
8
|
+
llama.cpp b12973) and defaults an omitted ``reasoning_effort`` to ``high``.
|
|
9
|
+
``chat_templates/qwen4-35b-a3b.jinja`` is that template with ``medium`` mapped to ``low`` and
|
|
10
|
+
the omitted default changed to ``low``, keeping ``enable_thinking: false`` / ``none`` and
|
|
11
|
+
explicit ``low``/``high``/``xhigh`` untouched (tests/test_chat_template.py pins the original).
|
|
12
|
+
|
|
7
13
|
``keep_prefix`` is the other step that puts files beside a llama-server deployment through
|
|
8
14
|
``config_files``: the launcher that keeps the agent's prompt prefix (slot_cache.py).
|
|
9
15
|
"""
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{#- Qwen4 Jinja chat template for compatibility only. Deliberate omissions:
|
|
2
|
+
- tool-result ordering is limited to text-only runs with explicit tool_call_id.
|
|
3
|
+
Media runs keep input order: HF collects media before rendering this template.
|
|
4
|
+
Missing/null tool_call_id never falls back to id: newer HF versions strip null
|
|
5
|
+
fields before rendering, so these cases cannot be distinguished here.
|
|
6
|
+
For full Python ordering semantics, reorder messages before media collection.
|
|
7
|
+
- tool_calls[].function.arguments is only read as a dict; other types cause exceptions.
|
|
8
|
+
- no anti-injection: the encoder tokenizes data with allow_special=false, so message
|
|
9
|
+
text can never become a control token. A flat string cannot express that, and
|
|
10
|
+
re-tokenizing it does not reproduce the encoder's token ids -- use the Qwen4
|
|
11
|
+
tokenizer's apply_chat_template(tokenize=True) for exact ids.
|
|
12
|
+
- the generation blocks (return_assistant_tokens_mask) cover a whole assistant
|
|
13
|
+
body; the encoder additionally masks out media placeholders inside it.
|
|
14
|
+
-#}
|
|
15
|
+
{%- macro render_content(content) -%}
|
|
16
|
+
{%- if content is string -%}
|
|
17
|
+
{{- content -}}
|
|
18
|
+
{%- elif content is iterable and content is not mapping -%}
|
|
19
|
+
{%- for item in content -%}
|
|
20
|
+
{%- if item is string -%}
|
|
21
|
+
{{- item -}}
|
|
22
|
+
{%- elif item.get('type') == 'text' -%}
|
|
23
|
+
{{- item.get('text', '') | default('', true) -}}
|
|
24
|
+
{%- elif item.get('type') in ('image', 'image_url') -%}
|
|
25
|
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' -}}
|
|
26
|
+
{%- elif item.get('type') in ('video', 'video_url') -%}
|
|
27
|
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' -}}
|
|
28
|
+
{%- elif item.get('type') in ('audio', 'audio_url') -%}
|
|
29
|
+
{{- '<|audio_start|><|audio_pad|><|audio_end|>' -}}
|
|
30
|
+
{%- else -%}
|
|
31
|
+
{{- raise_exception('Unexpected content part type ' ~ item.get('type') ~ '. Supported types are text, image, image_url, video, video_url, audio and audio_url.') -}}
|
|
32
|
+
{%- endif -%}
|
|
33
|
+
{%- endfor -%}
|
|
34
|
+
{%- elif content is not none -%}
|
|
35
|
+
{{- content | tojson -}}
|
|
36
|
+
{%- endif -%}
|
|
37
|
+
{%- endmacro -%}
|
|
38
|
+
{%- macro render_reasoning(reasoning) -%}
|
|
39
|
+
{%- if reasoning is string -%}
|
|
40
|
+
{{- reasoning -}}
|
|
41
|
+
{%- elif reasoning is iterable and reasoning is not mapping -%}
|
|
42
|
+
{%- for item in reasoning -%}
|
|
43
|
+
{%- if item is string -%}
|
|
44
|
+
{{- item -}}
|
|
45
|
+
{%- elif item.get('type') in (none, 'text') -%}
|
|
46
|
+
{{- item.get('text', '') | default('', true) -}}
|
|
47
|
+
{%- else -%}
|
|
48
|
+
{{- item | tojson -}}
|
|
49
|
+
{%- endif -%}
|
|
50
|
+
{%- endfor -%}
|
|
51
|
+
{%- elif reasoning is not none -%}
|
|
52
|
+
{{- reasoning | tojson -}}
|
|
53
|
+
{%- endif -%}
|
|
54
|
+
{%- endmacro -%}
|
|
55
|
+
{%- macro render_tools(tools) -%}
|
|
56
|
+
{{- '# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>\n' -}}
|
|
57
|
+
{%- for tool in tools -%}
|
|
58
|
+
{%- if tool is not mapping -%}
|
|
59
|
+
{{- raise_exception('Unexpected tool spec ' ~ tool ~ '. Expected a function schema dict.') -}}
|
|
60
|
+
{%- elif tool.get('type') == 'function' and 'function' in tool -%}
|
|
61
|
+
{{- tool | tojson -}}
|
|
62
|
+
{%- elif 'function' in tool -%}
|
|
63
|
+
{{- ({'type': 'function', 'function': tool['function']}) | tojson -}}
|
|
64
|
+
{%- else -%}
|
|
65
|
+
{{- ({'type': 'function', 'function': tool}) | tojson -}}
|
|
66
|
+
{%- endif -%}
|
|
67
|
+
{{- '\n' -}}
|
|
68
|
+
{%- endfor -%}
|
|
69
|
+
{{- '</tools>\n\nIf you choose to call a function, use exactly this format:\n' -}}
|
|
70
|
+
{{- '<tool_call>\n<function={function-name}>\n<parameter={parameter-name}>\n{parameter-value}\n</parameter>\n</function>\n</tool_call>' -}}
|
|
71
|
+
{%- endmacro -%}
|
|
72
|
+
{%- macro render_tool_calls(tool_calls) -%}
|
|
73
|
+
{%- for tool_call in tool_calls -%}
|
|
74
|
+
{%- if tool_call.function is mapping -%}
|
|
75
|
+
{%- set name = tool_call.function.get('name', '') -%}
|
|
76
|
+
{%- set arguments = tool_call.function.get('arguments') -%}
|
|
77
|
+
{%- else -%}
|
|
78
|
+
{%- set name = tool_call.get('name', '') -%}
|
|
79
|
+
{%- set arguments = tool_call.get('arguments') -%}
|
|
80
|
+
{%- endif -%}
|
|
81
|
+
{{- '<tool_call>\n<function=' ~ name ~ '>\n' -}}
|
|
82
|
+
{%- if arguments is mapping -%}
|
|
83
|
+
{%- for arg_name, arg_value in arguments | items -%}
|
|
84
|
+
{{- '<parameter=' ~ (arg_name if arg_name is string else arg_name | tojson) ~ '>\n' -}}
|
|
85
|
+
{{- arg_value if arg_value is string else arg_value | tojson -}}
|
|
86
|
+
{{- '\n</parameter>\n' -}}
|
|
87
|
+
{%- endfor -%}
|
|
88
|
+
{%- elif arguments is not none and (arguments is not string or (arguments | trim) != '') -%}
|
|
89
|
+
{{- raise_exception('Unexpected argument types. Expected dict.') -}}
|
|
90
|
+
{%- endif -%}
|
|
91
|
+
{{- '</function>\n</tool_call>' -}}
|
|
92
|
+
{%- endfor -%}
|
|
93
|
+
{%- endmacro -%}
|
|
94
|
+
{%- set enable_thinking = enable_thinking | default(none) -%}
|
|
95
|
+
{%- if enable_thinking is not none and enable_thinking is not boolean -%}
|
|
96
|
+
{{- raise_exception('Unexpected enable_thinking ' ~ enable_thinking ~ '. Expected true, false or none.') -}}
|
|
97
|
+
{%- endif -%}
|
|
98
|
+
{%- set reasoning_effort = reasoning_effort | default(none) -%}
|
|
99
|
+
{%- if reasoning_effort == 'medium' -%}
|
|
100
|
+
{%- set reasoning_effort = 'low' -%}
|
|
101
|
+
{%- endif -%}
|
|
102
|
+
{%- if reasoning_effort is not none and reasoning_effort not in ('xhigh', 'high', 'low', 'off') -%}
|
|
103
|
+
{{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported efforts are xhigh, high, low and off.') -}}
|
|
104
|
+
{%- endif -%}
|
|
105
|
+
{%- if enable_thinking is none -%}
|
|
106
|
+
{%- set effort = reasoning_effort if reasoning_effort is not none else 'low' -%}
|
|
107
|
+
{%- elif enable_thinking -%}
|
|
108
|
+
{%- if reasoning_effort == 'off' -%}
|
|
109
|
+
{{- raise_exception('Conflicting thinking settings: enable_thinking=true with reasoning_effort=off.') -}}
|
|
110
|
+
{%- endif -%}
|
|
111
|
+
{%- set effort = reasoning_effort if reasoning_effort is not none else 'low' -%}
|
|
112
|
+
{%- else -%}
|
|
113
|
+
{%- if reasoning_effort is not none and reasoning_effort != 'off' -%}
|
|
114
|
+
{{- raise_exception('Conflicting thinking settings: enable_thinking=false with reasoning_effort=' ~ reasoning_effort ~ '.') -}}
|
|
115
|
+
{%- endif -%}
|
|
116
|
+
{%- set effort = 'off' -%}
|
|
117
|
+
{%- endif -%}
|
|
118
|
+
{%- set preserve_thinking = preserve_thinking | default(true) -%}
|
|
119
|
+
{%- if preserve_thinking is not none and preserve_thinking is not boolean -%}
|
|
120
|
+
{{- raise_exception('Unexpected preserve_thinking ' ~ preserve_thinking ~ '. Expected true, false or none.') -}}
|
|
121
|
+
{%- endif -%}
|
|
122
|
+
{%- set preserve_thinking = true if preserve_thinking is none else preserve_thinking -%}
|
|
123
|
+
{{- '<|im_start|>system\n' + 'Reasoning effort is set to ' + effort + '.' -}}
|
|
124
|
+
{%- if tools -%}
|
|
125
|
+
{{- '\n\n' -}}
|
|
126
|
+
{{- render_tools(tools) -}}
|
|
127
|
+
{%- endif -%}
|
|
128
|
+
{{- '<|im_end|>\n' -}}
|
|
129
|
+
{#- Sort text-only tool-result runs only when every explicit tool_call_id resolves. -#}
|
|
130
|
+
{%- set order = namespace(messages=[], call_ids=[], pending=[], unresolved=false) -%}
|
|
131
|
+
{%- for message in messages + [none] -%}
|
|
132
|
+
{%- if message is none or message.get('role') != 'tool' -%}
|
|
133
|
+
{%- if not order.unresolved -%}
|
|
134
|
+
{%- set order.pending = order.pending | sort(attribute='position') -%}
|
|
135
|
+
{%- endif -%}
|
|
136
|
+
{%- for item in order.pending -%}
|
|
137
|
+
{%- set order.messages = order.messages + [item.message] -%}
|
|
138
|
+
{%- endfor -%}
|
|
139
|
+
{%- set order.pending = [] -%}
|
|
140
|
+
{%- set order.unresolved = false -%}
|
|
141
|
+
{%- if message is not none -%}
|
|
142
|
+
{%- if message.get('role') == 'assistant' -%}
|
|
143
|
+
{%- set order.call_ids = [] -%}
|
|
144
|
+
{%- for call in message.get('tool_calls') or [] -%}
|
|
145
|
+
{%- if call is mapping and call.get('id') is not none -%}
|
|
146
|
+
{%- set order.call_ids = order.call_ids + [call.id | string] -%}
|
|
147
|
+
{%- endif -%}
|
|
148
|
+
{%- endfor -%}
|
|
149
|
+
{%- endif -%}
|
|
150
|
+
{%- set order.messages = order.messages + [message] -%}
|
|
151
|
+
{%- endif -%}
|
|
152
|
+
{%- else -%}
|
|
153
|
+
{#- Do not reorder media independently of the processor's already-collected inputs. -#}
|
|
154
|
+
{%- set content = message.get('content') -%}
|
|
155
|
+
{%- if content is iterable and content is not string and content is not mapping -%}
|
|
156
|
+
{%- for part in content -%}
|
|
157
|
+
{%- if part is not string and (part is not mapping or part.get('type') != 'text') -%}
|
|
158
|
+
{%- set order.unresolved = true -%}
|
|
159
|
+
{%- endif -%}
|
|
160
|
+
{%- endfor -%}
|
|
161
|
+
{%- elif content is not none and content is not string -%}
|
|
162
|
+
{%- set order.unresolved = true -%}
|
|
163
|
+
{%- endif -%}
|
|
164
|
+
{%- set cid = message.get('tool_call_id') -%}
|
|
165
|
+
{%- set match = namespace(position=none) -%}
|
|
166
|
+
{%- for call_id in order.call_ids -%}
|
|
167
|
+
{%- if cid is not none and call_id == (cid | string) and match.position is none -%}
|
|
168
|
+
{%- set match.position = loop.index0 -%}
|
|
169
|
+
{%- endif -%}
|
|
170
|
+
{%- endfor -%}
|
|
171
|
+
{%- if match.position is none -%}
|
|
172
|
+
{%- set order.unresolved = true -%}
|
|
173
|
+
{%- endif -%}
|
|
174
|
+
{%- set order.pending = order.pending + [{'position': match.position, 'message': message}] -%}
|
|
175
|
+
{%- endif -%}
|
|
176
|
+
{%- endfor -%}
|
|
177
|
+
{%- set messages = order.messages -%}
|
|
178
|
+
{#- with preserve_thinking=false, reasoning survives only on and after the last user turn -#}
|
|
179
|
+
{%- set ns = namespace(last_user=-1) -%}
|
|
180
|
+
{%- if not preserve_thinking -%}
|
|
181
|
+
{%- for message in messages -%}
|
|
182
|
+
{%- if message.get('role') == 'user' -%}
|
|
183
|
+
{%- set ns.last_user = loop.index0 -%}
|
|
184
|
+
{%- endif -%}
|
|
185
|
+
{%- endfor -%}
|
|
186
|
+
{%- endif -%}
|
|
187
|
+
{%- for message in messages -%}
|
|
188
|
+
{%- set role = 'system' if message.get('role') == 'developer' else message.get('role') -%}
|
|
189
|
+
{%- if role in ('system', 'user') -%}
|
|
190
|
+
{{- '<|im_start|>' + role + '\n' + render_content(message.get('content')) + '<|im_end|>\n' -}}
|
|
191
|
+
{%- elif role == 'assistant' -%}
|
|
192
|
+
{%- if not preserve_thinking and loop.index0 < ns.last_user -%}
|
|
193
|
+
{%- set reasoning = '' -%}
|
|
194
|
+
{%- elif 'reasoning_content' in message -%}
|
|
195
|
+
{%- set reasoning = render_reasoning(message['reasoning_content']) | trim -%}
|
|
196
|
+
{%- elif 'reasoning' in message -%}
|
|
197
|
+
{%- set reasoning = render_reasoning(message['reasoning']) | trim -%}
|
|
198
|
+
{%- else -%}
|
|
199
|
+
{%- set reasoning = '' -%}
|
|
200
|
+
{%- endif -%}
|
|
201
|
+
{%- set content = render_content(message.get('content')) | trim -%}
|
|
202
|
+
{{- '<|im_start|>assistant\n' -}}
|
|
203
|
+
{%- generation -%}
|
|
204
|
+
{{- '<think>' + reasoning + '</think>' + content -}}
|
|
205
|
+
{%- if message.get('tool_calls') -%}
|
|
206
|
+
{{- render_tool_calls(message['tool_calls']) -}}
|
|
207
|
+
{%- endif -%}
|
|
208
|
+
{{- '<|im_end|>' -}}
|
|
209
|
+
{%- endgeneration -%}
|
|
210
|
+
{{- '\n' -}}
|
|
211
|
+
{%- elif role == 'tool' -%}
|
|
212
|
+
{{- '<|im_start|>tool\n' + render_content(message.get('content')) + '\n<|im_end|>\n' -}}
|
|
213
|
+
{%- else -%}
|
|
214
|
+
{{- raise_exception('Unexpected message role ' ~ message.get('role') ~ '. Supported roles are system, developer, user, assistant and tool.') -}}
|
|
215
|
+
{%- endif -%}
|
|
216
|
+
{%- endfor -%}
|
|
217
|
+
{%- if add_generation_prompt -%}
|
|
218
|
+
{{- '<|im_start|>assistant\n' -}}
|
|
219
|
+
{{- '<think>' -}}
|
|
220
|
+
{%- if effort == 'off' -%}
|
|
221
|
+
{{- '</think>' -}}
|
|
222
|
+
{%- endif -%}
|
|
223
|
+
{%- endif -%}
|
|
@@ -511,7 +511,7 @@ def _make_tts_handler(served_model: str, engine_mode: str) -> type[BaseHTTPReque
|
|
|
511
511
|
sample_rate = tts_worker_moss.DEFAULT_SAMPLE_RATE
|
|
512
512
|
else:
|
|
513
513
|
engine_name = (
|
|
514
|
-
"
|
|
514
|
+
"onnxruntime" if engine_mode == "tts-kokoro" else engine_mode.removeprefix("tts-")
|
|
515
515
|
)
|
|
516
516
|
sample_rate = tts_worker_kokoro.DEFAULT_SAMPLE_RATE
|
|
517
517
|
|
|
@@ -218,10 +218,6 @@
|
|
|
218
218
|
"repo": "prism-ml/Ternary-Bonsai-2.5-27B-GGUF",
|
|
219
219
|
"path": "Ternary-Bonsai-2.5-27B-PTQ1_0-mtp.gguf"
|
|
220
220
|
},
|
|
221
|
-
"e287342d92332fa3577ed1d42e921dac9370c08da58ba9337fa450f6cc76cfd7": {
|
|
222
|
-
"repo": "prism-ml/Ternary-Bonsai-2.5-27B-GGUF",
|
|
223
|
-
"path": "Ternary-Bonsai-2.5-27B-mmproj-BF16.gguf"
|
|
224
|
-
},
|
|
225
221
|
"cd1140f4abba943ce8d9fa92fed8407e389954d26907efde7b72153c75bd8a60": {
|
|
226
222
|
"repo": "ukisai/Swift-1.5-Qwen3.8-Flash-Next-GSQ-RCO-GGUF",
|
|
227
223
|
"path": "mmproj-Swift-Qwen3.8-Flash-Next-BF16.gguf"
|
|
@@ -430,42 +426,14 @@
|
|
|
430
426
|
"repo": "unsloth/gemma-4-26B-A4B-it-GGUF",
|
|
431
427
|
"path": "gemma-4-26B-A4B-it-UD-Q3_K_M.gguf"
|
|
432
428
|
},
|
|
433
|
-
"acc4adc175b9d9986106cd20060329673ad5a2e12ef3c557d2d3745b694f8b38": {
|
|
434
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
435
|
-
"path": "model.onnx"
|
|
436
|
-
},
|
|
437
|
-
"e64a5a581d8c2a350d848f51c3121657cd83aa07ed6109172177345874a7244c": {
|
|
438
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
439
|
-
"path": "voices.bin"
|
|
440
|
-
},
|
|
441
|
-
"931ab2df2400cd65d580a22402024c2347ced8ae9ea300e545144b1aacc48e14": {
|
|
442
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
443
|
-
"path": "tokens.txt"
|
|
444
|
-
},
|
|
445
429
|
"7daaab53a181be9885b853a8582bf1838186317e5dadacbcef9c426d6fa0da14": {
|
|
446
|
-
"repo": "
|
|
430
|
+
"repo": "luozx123/kokoro-int8-multi-lang-v1_0",
|
|
447
431
|
"path": "lexicon-us-en.txt"
|
|
448
432
|
},
|
|
449
433
|
"c4cbb37316f62210dff52718a7afcaae24f50c032cc75ab47ae67b831d1049e7": {
|
|
450
|
-
"repo": "
|
|
434
|
+
"repo": "luozx123/kokoro-int8-multi-lang-v1_0",
|
|
451
435
|
"path": "lexicon-gb-en.txt"
|
|
452
436
|
},
|
|
453
|
-
"11111d8cd695fba2ace1367a1d0a708b586e6ef5c1f9be91da5d7eef129b651c": {
|
|
454
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
455
|
-
"path": "lexicon-zh.txt"
|
|
456
|
-
},
|
|
457
|
-
"eb8aa079ae3cb81d8f4404992f39d61a0cb990947512b5b8d1e54d1f6980e718": {
|
|
458
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
459
|
-
"path": "date-zh.fst"
|
|
460
|
-
},
|
|
461
|
-
"743f402181fcfebf76cc2f0546b71fa26476e626fbe4e460fb7b4c3a7a8bd5bd": {
|
|
462
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
463
|
-
"path": "number-zh.fst"
|
|
464
|
-
},
|
|
465
|
-
"1ac2b6fa56b1442320c4de7db08353bab8963a2b57f365eebcdd3a2d3562f8d7": {
|
|
466
|
-
"repo": "HZZSCIENCE/kokoro-multi-lang-v1_1",
|
|
467
|
-
"path": "phone-zh.fst"
|
|
468
|
-
},
|
|
469
437
|
"d56126dcd0574c2f15d98fc6b35eda68d0386b5bd9c5e38e28548d6f2ea8f3db": {
|
|
470
438
|
"repo": "openmoss/MOSS-TTS-Nano-100M-ONNX",
|
|
471
439
|
"path": "moss_tts_prefill.onnx"
|
|
@@ -505,9 +473,30 @@
|
|
|
505
473
|
"1bc0ef69547c003507b6536639a6080c8856382f4d0963b15d4475528330592d": {
|
|
506
474
|
"repo": "sakasegawa/Qwen3-TTS-12Hz-1.7B-CustomVoice-GGUF",
|
|
507
475
|
"path": "Qwen3-TTS-12Hz-1.7B-CustomVoice-Q8_0.gguf"
|
|
476
|
+
},
|
|
477
|
+
"fbae9257e1e05ffc727e951ef9b9c98418e6d79f1c9b6b13bd59f5c9028a1478": {
|
|
478
|
+
"repo": "onnx-community/Kokoro-82M-v1.0-ONNX",
|
|
479
|
+
"path": "onnx/model_quantized.onnx"
|
|
480
|
+
},
|
|
481
|
+
"902bc2d20ac7c449c5ecbbbb23c89d12119c03ed5b8ed27f114f0260c9e35229": {
|
|
482
|
+
"repo": "luozx123/kokoro-int8-multi-lang-v1_0",
|
|
483
|
+
"path": "lexicon-zh.txt"
|
|
484
|
+
},
|
|
485
|
+
"1c5a5b983d3d50d8586d437a51f3faa2da7919ce76a013c081e65671a3447c29": {
|
|
486
|
+
"repo": "luozx123/kokoro-int8-multi-lang-v1_0",
|
|
487
|
+
"path": "voices.bin"
|
|
488
|
+
},
|
|
489
|
+
"6ebb6bb288f20f3ae8d004d3c2ca27697da27c037d75e81a60e2a6a663f95425": {
|
|
490
|
+
"repo": "luozx123/kokoro-int8-multi-lang-v1_0",
|
|
491
|
+
"path": "tokens.txt"
|
|
508
492
|
}
|
|
509
493
|
},
|
|
510
494
|
"unmirrored": {
|
|
495
|
+
"262364a7a178fbabfc5c36ac305e04f622cb1f46bfb103d1e6489c18c2c12f33": {
|
|
496
|
+
"repo": "fritskarl/Inkling-2-Mini-Unbound-v3-Fast-pi-final-IQ3_M-GGUF",
|
|
497
|
+
"path": "Inkling-2-Mini-Unbound-v3-Fast-pi-final-IQ3_M.gguf",
|
|
498
|
+
"reason": "repo absent on modelscope"
|
|
499
|
+
},
|
|
511
500
|
"322e194ff79741c7baa497c240f677f54b201b0efab44ca8e50f122b39123482": {
|
|
512
501
|
"repo": "unsloth/Qwen3.8-27B-GGUF",
|
|
513
502
|
"path": "Qwen3.8-27B-UD-Q4_K_M.gguf",
|
|
@@ -27,7 +27,7 @@ from localmodels.engines import (
|
|
|
27
27
|
release_engine,
|
|
28
28
|
select_engine_build,
|
|
29
29
|
)
|
|
30
|
-
from localmodels.estimator import as_loaded
|
|
30
|
+
from localmodels.estimator import as_loaded
|
|
31
31
|
from localmodels.plan_envelope import PlanError, catalog_pins, hub_url
|
|
32
32
|
from localmodels.planning.budget import Backend, Placement
|
|
33
33
|
from localmodels.probe import GPU, HostFacts, OptionalEngine
|
|
@@ -148,7 +148,7 @@ class MetalBackend(LlamaBackend):
|
|
|
148
148
|
agent: AgentPosture,
|
|
149
149
|
) -> dict[str, object]:
|
|
150
150
|
"""The prompt cache's floor shares unified memory with the model."""
|
|
151
|
-
profile =
|
|
151
|
+
profile = entry.agent_profile(variant)
|
|
152
152
|
return {
|
|
153
153
|
"unified_bytes": agent_unified_bytes(profile, decision, agent),
|
|
154
154
|
"cache_floor_bytes": cache_floor_bytes(agent, profile),
|
|
@@ -323,9 +323,15 @@ def trailing_args(
|
|
|
323
323
|
*,
|
|
324
324
|
agent: bool,
|
|
325
325
|
) -> list[str]:
|
|
326
|
-
"""The argv after the server's own flags: lazy loading (
|
|
327
|
-
companions, the catalog's sampling and the device."""
|
|
328
|
-
argv
|
|
326
|
+
"""The argv after the server's own flags: lazy loading (explicit tensor offload or generic
|
|
327
|
+
ladder), the companions, the catalog's sampling and the device."""
|
|
328
|
+
argv: list[str] = []
|
|
329
|
+
if variant.lazy_bytes and entry.lazy_offload_tensors:
|
|
330
|
+
argv += ["--load-mode", "mmap", "--lazy-mode", "on"]
|
|
331
|
+
for pattern in entry.lazy_offload_tensors:
|
|
332
|
+
argv += ["-ot", f"{pattern}=CPU"]
|
|
333
|
+
elif variant.lazy_bytes and not agent:
|
|
334
|
+
argv += ["--lazy-mode", "on"]
|
|
329
335
|
by_name = {f["path"]: f for f in files}
|
|
330
336
|
if extra.mmproj is not None:
|
|
331
337
|
argv += vision.llama_args(by_name[extra.mmproj.path]["dest"], extra.reader)
|
|
@@ -65,7 +65,7 @@ class PolyStrataAdapter(StrataAdapter):
|
|
|
65
65
|
if "--threads" in args:
|
|
66
66
|
return []
|
|
67
67
|
logical = facts.get("cpu", {}).get("logical_cores")
|
|
68
|
-
if not isinstance(logical, int) or logical <
|
|
68
|
+
if not isinstance(logical, int) or isinstance(logical, bool) or logical < 1:
|
|
69
69
|
return []
|
|
70
70
|
return ["--threads", str(windows_job.poly_cpu_threads(logical))]
|
|
71
71
|
|