ryugyosoft commited on
Commit
c890b76
·
verified ·
1 Parent(s): 641eec1

onw 0.10.3: NPUW works again for the split parts (Lunar Lake memory + compile time); 3720 DCOFF crash fix

Browse files
CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@
5
  日付は日本時間です。各版は Hugging Face の `ryugyosoft/onw` にタグ(`v0.4.2` 以降)付きで残っています。
6
  onw ウィンドウは、新しい版があるとこのファイルから変更点を表示します(`## v…` の見出しで区切っています)。
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  ## v0.10.2 (2026-09-29)
9
  - 「実験的な設定」のスイッチを入れてもすぐオフに戻る問題を修正(編集中と見なされず、数秒ごとの状態更新で
10
  保存済みの値に上書きされていました)。
 
5
  日付は日本時間です。各版は Hugging Face の `ryugyosoft/onw` にタグ(`v0.4.2` 以降)付きで残っています。
6
  onw ウィンドウは、新しい版があるとこのファイルから変更点を表示します(`## v…` の見出しで区切っています)。
7
 
8
+ ## v0.10.3 (2026-09-29)
9
+ - **Lunar Lake:0.10 以降 NPUW 重み共有が効いていなかった問題を修正**。0.10 でグラフをアテンションごとに切り分けるようになった
10
+ 部品に対して NPUW の自動分割が「宣言されていない Parameter」で失敗し、全部が通常コンパイルに落ちていました(重みが
11
+ 1 トークン用と 16 トークン用の 2 コピーになり、Gemma 4 のコンパイルが 243 秒)。部品はほぼ 1 層ぶんで折り畳むものが
12
+ ないので NPUW の分割をせず 1 サブグラフとしてコンパイルし、重みは共有バンクで持ちます。LM ヘッドの区間も同じ方法で
13
+ NPUW を通します。以前の「通常コンパイル」の記録は無効にするので、次の読み込みで一度コンパイルし直します(古い
14
+ コンパイル結果はモデルの「コンパイルキャッシュを削除」で消せます)。
15
+ - 保存後の確認ダイアログを「設定は保存しました。今すぐ再起動しますか?」に。キャンセルは再起動をやめるだけで、
16
+ 設定は保存されています(次にモデルを読み込むときから反映)。
17
+ - NPU 3720 で `ONW_NPUW=1` を使ったとき、最初の推論で落ちる問題を修正(重みを展開する DCOFF がモデルの .bin を
18
+ 参照し続けるのに、読み込み後に解放していました)。3720 では NPUW は重みを FP16 に展開するためメモリを大きく
19
+ 使います(Gemma 4 で 8.9 → 31.6 GB)。既定どおりオフのままを推奨します。
20
+
21
  ## v0.10.2 (2026-09-29)
22
  - 「実験的な設定」のスイッチを入れてもすぐオフに戻る問題を修正(編集中と見なされず、数秒ごとの状態更新で
23
  保存済みの値に上書きされていました)。
CHANGELOG_en.md CHANGED
@@ -4,6 +4,19 @@
4
 
5
  Dates are JST. Every version is on Hugging Face `ryugyosoft/onw`, tagged from `v0.4.2` on.
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  ## v0.10.2 (2026-09-29)
8
  - The "Experimental" switches no longer flip back off right away (they did not count as being edited, so the status
9
  refresh every few seconds overwrote them with the saved values).
 
4
 
5
  Dates are JST. Every version is on Hugging Face `ryugyosoft/onw`, tagged from `v0.4.2` on.
6
 
7
+ ## v0.10.3 (2026-09-29)
8
+ - **Lunar Lake: NPUW weight sharing had stopped working since 0.10.** NPUW's automatic partitioning failed on the parts
9
+ that 0.10 cuts out at each attention layer ("undeclared parameters"), so everything fell back to a plain compile: two
10
+ copies of the weights (1-token and 16-token graphs) and a 243 s compile for Gemma 4. A part holds about one layer, so
11
+ there is nothing to fold: it is now compiled as one NPUW subgraph with the weights in the shared bank, and the LM head
12
+ segment goes the same way. The old "plain" route records are invalidated, so the next load compiles once more (the
13
+ old compiled files can be removed with the model's "delete compile cache").
14
+ - The dialog after saving now says the settings are saved and asks only about restarting now; Cancel skips the
15
+ restart, the settings stay (in effect from the next model load).
16
+ - NPU 3720 with `ONW_NPUW=1` crashed at the first inference (DCOFF keeps reading the model's .bin, which was released
17
+ after loading). NPUW on the 3720 expands the weights to FP16 and needs much more memory (Gemma 4: 8.9 -> 31.6 GB);
18
+ leave it off there, as by default.
19
+
20
  ## v0.10.2 (2026-09-29)
21
  - The "Experimental" switches no longer flip back off right away (they did not count as being edited, so the status
22
  refresh every few seconds overwrote them with the saved values).
TECHNICAL.md CHANGED
@@ -77,6 +77,9 @@ NPU は形の決まったグラフしか扱えませんが、MoE はトークン
77
  なので、共有されるのはそれ以外の重み)、`NPUW_FUNCALL_ASYNC`(`ONW_NPUW_ASYNC=1`)、重みなしのコンパイルキャッシュ
78
  `CACHE_MODE=OPTIMIZE_SIZE`(`ONW_CACHE_SIZE=1`)を足せます。どれも llama.cpp の OpenVINO 版が NPU で使っている設定で、
79
  有効にした組み合わせごとに経路の記録を分けます。
 
 
 
80
 
81
  ## Gated DeltaNet(ハイブリッドモデル)を NPU で動かす
82
 
 
77
  なので、共有されるのはそれ以外の重み)、`NPUW_FUNCALL_ASYNC`(`ONW_NPUW_ASYNC=1`)、重みなしのコンパイルキャッシュ
78
  `CACHE_MODE=OPTIMIZE_SIZE`(`ONW_CACHE_SIZE=1`)を足せます。どれも llama.cpp の OpenVINO 版が NPU で使っている設定で、
79
  有効にした組み合わせごとに経路の記録を分けます。
80
+ 切り分けた部品は NPUW の自動分割(オンラインパーティショナー)が「宣言されていない Parameter」で拒否するので、
81
+ `NPUW_ONLINE_PIPELINE=NONE`(1 サブグラフ)でコンパイルします。部品は 1 層ぶんなので折り畳みの損はなく、重みの共有は
82
+ バンク経由で効きます(0.10.3)。
83
 
84
  ## Gated DeltaNet(ハイブリッドモデル)を NPU で動かす
85
 
TECHNICAL_en.md CHANGED
@@ -76,6 +76,9 @@ The experimental settings (v0.10.1) add NPUW for MoE models (`ONW_NPUW_MOE=1`; t
76
  once anyway, so it shares the other weights), `NPUW_FUNCALL_ASYNC` (`ONW_NPUW_ASYNC=1`) and a weightless compile cache,
77
  `CACHE_MODE=OPTIMIZE_SIZE` (`ONW_CACHE_SIZE=1`) - all as llama.cpp's OpenVINO backend uses them on the NPU. Each
78
  combination keeps its own route records.
 
 
 
79
 
80
  ## Gated DeltaNet (hybrid models) on the NPU
81
 
 
76
  once anyway, so it shares the other weights), `NPUW_FUNCALL_ASYNC` (`ONW_NPUW_ASYNC=1`) and a weightless compile cache,
77
  `CACHE_MODE=OPTIMIZE_SIZE` (`ONW_CACHE_SIZE=1`) - all as llama.cpp's OpenVINO backend uses them on the NPU. Each
78
  combination keeps its own route records.
79
+ NPUW's online partitioner rejects the split parts ("undeclared parameters"), so they compile with
80
+ `NPUW_ONLINE_PIPELINE=NONE` (one subgraph). A part is about one layer, so no folding is lost, and the weights are still
81
+ shared through the bank (0.10.3).
82
 
83
  ## Gated DeltaNet (hybrid models) on the NPU
84
 
onw/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
 
3
  A small engine that runs LLMs entirely on the Intel NPU: static segment graphs + host-managed state.
4
  """
5
- __version__ = "0.10.2"
 
2
 
3
  A small engine that runs LLMs entirely on the Intel NPU: static segment graphs + host-managed state.
4
  """
5
+ __version__ = "0.10.3"
onw/i18n.json CHANGED
@@ -66,7 +66,6 @@
66
  "サイズ": "Size",
67
  "サーバー": "Server",
68
  "サーバーに接続できません": "Cannot connect to the server",
69
- "サーバーを新しい設定で再起動しますか?": "Restart the server with the new settings?",
70
  "ダウンロード": "Download",
71
  "ダウンロードに失敗: {0}": "Download failed: {0}",
72
  "ダウンロード中 {0}/{1}": "Downloading {0}/{1}",
@@ -196,6 +195,7 @@
196
  "自分で置いたモデル・{0}": "Your own model · {0}",
197
  "言語": "Language",
198
  "設定": "Settings",
 
199
  "読み込み中…": "Loading…",
200
  "起動時と 1 日ごとに更新を確認する": "Check for updates at startup and daily",
201
  "起動時に前回ロードしたモデルを自動でロードする": "Load the last model automatically at startup",
@@ -278,7 +278,6 @@
278
  "サイズ": "大小",
279
  "サーバー": "服务器",
280
  "サーバーに接続できません": "无法连接服务器",
281
- "サーバーを新しい設定で再起動しますか?": "用新设置重启服务器?",
282
  "ダウンロード": "下载",
283
  "ダウンロードに失敗: {0}": "下载失败:{0}",
284
  "ダウンロード中 {0}/{1}": "下载中 {0}/{1}",
@@ -408,6 +407,7 @@
408
  "自分で置いたモデル・{0}": "自行放置的模型・{0}",
409
  "言語": "语言",
410
  "設定": "设置",
 
411
  "読み込み中…": "加载中…",
412
  "起動時と 1 日ごとに更新を確認する": "启动时及每天检查更新",
413
  "起動時に前回ロードしたモデルを自動でロードする": "启动时自动加载上次的模型",
 
66
  "サイズ": "Size",
67
  "サーバー": "Server",
68
  "サーバーに接続できません": "Cannot connect to the server",
 
69
  "ダウンロード": "Download",
70
  "ダウンロードに失敗: {0}": "Download failed: {0}",
71
  "ダウンロード中 {0}/{1}": "Downloading {0}/{1}",
 
195
  "自分で置いたモデル・{0}": "Your own model · {0}",
196
  "言語": "Language",
197
  "設定": "Settings",
198
+ "設定は保存しました。サーバーを新しい設定で今すぐ再起動しますか?(キャンセルしても、次にモデルを読み込むときから反映されます)": "Settings saved. Restart the server with the new settings now? (Cancel keeps them for the next model load.)",
199
  "読み込み中…": "Loading…",
200
  "起動時と 1 日ごとに更新を確認する": "Check for updates at startup and daily",
201
  "起動時に前回ロードしたモデルを自動でロードする": "Load the last model automatically at startup",
 
278
  "サイズ": "大小",
279
  "サーバー": "服务器",
280
  "サーバーに接続できません": "无法连接服务器",
 
281
  "ダウンロード": "下载",
282
  "ダウンロードに失敗: {0}": "下载失败:{0}",
283
  "ダウンロード中 {0}/{1}": "下载中 {0}/{1}",
 
407
  "自分で置いたモデル・{0}": "自行放置的模型・{0}",
408
  "言語": "语言",
409
  "設定": "设置",
410
+ "設定は保存しました。サーバーを新しい設定で今すぐ再起動しますか?(キャンセルしても、次にモデルを読み込むときから反映されます)": "设置已保存。现在用新设置重启服务器?(取消后,下次加载模型时生效)",
411
  "読み込み中…": "加载中…",
412
  "起動時と 1 日ごとに更新を確認する": "启动时及每天检查更新",
413
  "起動時に前回ロードしたモデルを自動でロードする": "启动时自动加载上次的模型",
onw/runtime.py CHANGED
@@ -199,7 +199,8 @@ class _Tried:
199
  except Exception:
200
  drv = ""
201
  self.key = f"{npu_arch(core) if device == 'NPU' else device}|{drv}|{ov.__version__}|npuw={npuw}"
202
- if npuw: # the opt-in NPUW options get routes of their own
 
203
  self.key += "".join(f"|{k}" for k in ("NPUW_FUNCALL_ASYNC", "CACHE_MODE") if k in (config or {}))
204
  try:
205
  self.all = json.load(open(self.path)) if self.path else {}
@@ -291,6 +292,9 @@ class SegmentedModel:
291
  **({"CACHE_MODE": "OPTIMIZE_SIZE"} if os.environ.get("ONW_CACHE_SIZE") == "1" else {}),
292
  **json.loads(os.environ.get("ONW_NPUW_EXTRA", "{}"))}
293
  bins = {}
 
 
 
294
  tried = _Tried(config, core, device, npuw)
295
  # with experts streamed from the SSD: every router (40 x 256 x 2048 f32 = 80 MB for Qwen3.6-35B) to predict a
296
  # layer's experts one segment early and read them while the NPU runs that segment
@@ -402,7 +406,10 @@ class SegmentedModel:
402
  binf = os.path.join(d, m.get("bin") or name[:-4] + ".bin")
403
  src = [open(os.path.join(d, name), "rb").read(), os.path.getsize(binf) if os.path.exists(binf) else 0, S, T, tried.key]
404
  if npuw:
405
- ways = [("npuw", config), ("npuw-1tile", {**config, "NPU_TILES": 1}), ("plain", plain)]
 
 
 
406
  elif device == "NPU":
407
  ways = [("plain", config), ("plain-1tile", {**config, "NPU_TILES": 1})]
408
  else:
@@ -481,7 +488,9 @@ class SegmentedModel:
481
  src = [open(os.path.join(d, name), "rb").read(), os.path.getsize(binf) if os.path.exists(binf) else 0, S,
482
  "paged-1", part, ring, _signature(model), tried.key]
483
  if npuw:
484
- ways = [("npuw", config), ("plain", plain)]
 
 
485
  elif device == "NPU":
486
  ways = [("plain", config), ("plain-1tile", {**config, "NPU_TILES": 1})]
487
  else:
 
199
  except Exception:
200
  drv = ""
201
  self.key = f"{npu_arch(core) if device == 'NPU' else device}|{drv}|{ov.__version__}|npuw={npuw}"
202
+ if npuw: # r2: the parts' NPUW route changed (0.10.3), old "plain" records must not stick
203
+ self.key += "|r2" # the opt-in NPUW options get routes of their own
204
  self.key += "".join(f"|{k}" for k in ("NPUW_FUNCALL_ASYNC", "CACHE_MODE") if k in (config or {}))
205
  try:
206
  self.all = json.load(open(self.path)) if self.path else {}
 
292
  **({"CACHE_MODE": "OPTIMIZE_SIZE"} if os.environ.get("ONW_CACHE_SIZE") == "1" else {}),
293
  **json.loads(os.environ.get("ONW_NPUW_EXTRA", "{}"))}
294
  bins = {}
295
+ # DCOFF (NPU < 4000) decompresses the weights from the model's constants at run time: keep the .bin buffers
296
+ # alive with the model there; with compiler DQ (4000+) the compiled graphs hold the weights (one copy)
297
+ self._bins = bins if npuw and npu_arch(core) < 4000 else None
298
  tried = _Tried(config, core, device, npuw)
299
  # with experts streamed from the SSD: every router (40 x 256 x 2048 f32 = 80 MB for Qwen3.6-35B) to predict a
300
  # layer's experts one segment early and read them while the NPU runs that segment
 
406
  binf = os.path.join(d, m.get("bin") or name[:-4] + ".bin")
407
  src = [open(os.path.join(d, name), "rb").read(), os.path.getsize(binf) if os.path.exists(binf) else 0, S, T, tried.key]
408
  if npuw:
409
+ # NPUW's online partitioner rejects some of our graphs ("undeclared parameters" at a cut it made, e.g. the
410
+ # LM head): one subgraph (PIPELINE=NONE) then, still with the weights bank
411
+ ways = [("npuw", config), ("npuw-none", {**config, "NPUW_ONLINE_PIPELINE": "NONE"}),
412
+ ("npuw-1tile", {**config, "NPU_TILES": 1}), ("plain", plain)]
413
  elif device == "NPU":
414
  ways = [("plain", config), ("plain-1tile", {**config, "NPU_TILES": 1})]
415
  else:
 
488
  src = [open(os.path.join(d, name), "rb").read(), os.path.getsize(binf) if os.path.exists(binf) else 0, S,
489
  "paged-1", part, ring, _signature(model), tried.key]
490
  if npuw:
491
+ # a part holds about one layer: nothing for NPUW's partitioner to fold, and its default pipeline fails on
492
+ # these graphs ("undeclared parameters"); one subgraph per part, weights shared through the bank
493
+ ways = [("npuw", {**config, "NPUW_ONLINE_PIPELINE": "NONE"}), ("plain", plain)]
494
  elif device == "NPU":
495
  ways = [("plain", config), ("plain-1tile", {**config, "NPU_TILES": 1})]
496
  else:
onw/web/manage.html CHANGED
@@ -365,7 +365,7 @@
365
  if (r.error) return;
366
  dirty = false;
367
  $("saved").textContent = T("保存しました");
368
- if (r.restart_needed && confirm(T("サーバーを新しい設定で再起動しますか?"))) await post("restart");
369
  if (oldLang !== body.lang) location.reload(); // the page is served in the new language
370
  }
371
  $("form").addEventListener("input", () => { dirty = true; $("saved").textContent = ""; });
 
365
  if (r.error) return;
366
  dirty = false;
367
  $("saved").textContent = T("保存しました");
368
+ if (r.restart_needed && confirm(T("設定は保存しました。サーバーを新しい設定で今すぐ再起動しますか?(キャンセルしても、次にモデルを読み込むときから反映されます)"))) await post("restart");
369
  if (oldLang !== body.lang) location.reload(); // the page is served in the new language
370
  }
371
  $("form").addEventListener("input", () => { dirty = true; $("saved").textContent = ""; });
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
 
5
  [project]
6
  name = "onw"
7
- version = "0.10.2"
8
  description = "Ore no NPU ga konna ni ugoku wake nai - LLMs entirely on the Intel NPU"
9
  readme = "README.md"
10
  license = {text = "Apache-2.0"}
 
4
 
5
  [project]
6
  name = "onw"
7
+ version = "0.10.3"
8
  description = "Ore no NPU ga konna ni ugoku wake nai - LLMs entirely on the Intel NPU"
9
  readme = "README.md"
10
  license = {text = "Apache-2.0"}