ryugyosoft commited on
Commit
64f4a9a
·
verified ·
1 Parent(s): 63211d2

onw AMD 0.1.2: memlock on Linux, warn about another FastFlowLM

Browse files
Files changed (10) hide show
  1. CHANGELOG.md +8 -0
  2. CHANGELOG_en.md +8 -0
  3. diag.py +9 -0
  4. onw/__init__.py +1 -1
  5. onw/i18n.json +6 -2
  6. onw/lemonade.py +19 -0
  7. onw/manager.py +4 -3
  8. onw/web/manage.html +5 -3
  9. pyproject.toml +1 -1
  10. setup.sh +21 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
  # 更新履歴
2
 
 
 
 
 
 
 
 
 
3
  ## v0.1.1
4
 
5
  - FastFlowLM を v1.0.7 に更新(v1.0.6 は Linux でカーネル 6.17 未満を一律に不合格にしていた。次のダウンロード時に自動で入れ替わります)。
 
1
  # 更新履歴
2
 
3
+ ## v0.1.2
4
+
5
+ - Linux:インストーラー(`setup.sh`)が memlock の上限を設定するように(FastFlowLM の Linux 手順で必須。Ubuntu の既定値では
6
+ `flm validate` が通らない)。設定したときは再起動を案内します。
7
+ - 「モデル」タブ:memlock で止まったときの直し方を具体的に表示。ほかの FastFlowLM(Lemonade Server やシステムの
8
+ fastflowlm パッケージの `flm serve` など)が動いていたら、NPU を取り合うので止めるよう表示。
9
+ - `diag.py`:動いている FastFlowLM と、システムに入っている fastflowlm/XRT/Lemonade のパッケージも報告。
10
+
11
  ## v0.1.1
12
 
13
  - FastFlowLM を v1.0.7 に更新(v1.0.6 は Linux でカーネル 6.17 未満を一律に不合格にしていた。次のダウンロード時に自動で入れ替わります)。
CHANGELOG_en.md CHANGED
@@ -1,5 +1,13 @@
1
  # Changelog
2
 
 
 
 
 
 
 
 
 
3
  ## v0.1.1
4
 
5
  - FastFlowLM updated to v1.0.7 (v1.0.6 failed every Linux kernel older than 6.17; it is replaced at the next download).
 
1
  # Changelog
2
 
3
+ ## v0.1.2
4
+
5
+ - Linux: the installer (`setup.sh`) raises the memlock limit (required by FastFlowLM's Linux guide; Ubuntu's default
6
+ fails `flm validate`) and asks for a restart when it did.
7
+ - Models tab: how to fix a memlock failure, and a warning when another FastFlowLM is running (Lemonade Server, a
8
+ system fastflowlm package's `flm serve`): they compete for the NPU.
9
+ - `diag.py` also reports running FastFlowLM processes and installed fastflowlm / XRT / Lemonade packages.
10
+
11
  ## v0.1.1
12
 
13
  - FastFlowLM updated to v1.0.7 (v1.0.6 failed every Linux kernel older than 6.17; it is replaced at the next download).
diag.py CHANGED
@@ -101,6 +101,15 @@ def main():
101
  show(["sh", "-c", "grep -rh memlock /etc/security/limits.conf /etc/security/limits.d/ 2>/dev/null | grep -v '^#'"])
102
  show(["sh", "-c", "journalctl -k --no-pager -g 'amdxdna|amdnpu' -n 40 2>/dev/null || dmesg 2>&1 | grep -i -E 'amdxdna|amdnpu' | tail -40"])
103
 
 
 
 
 
 
 
 
 
 
104
  section("FastFlowLM")
105
  cfg = config_dir()
106
  exe_name = "flm.exe" if WIN else "flm"
 
101
  show(["sh", "-c", "grep -rh memlock /etc/security/limits.conf /etc/security/limits.d/ 2>/dev/null | grep -v '^#'"])
102
  show(["sh", "-c", "journalctl -k --no-pager -g 'amdxdna|amdnpu' -n 40 2>/dev/null || dmesg 2>&1 | grep -i -E 'amdxdna|amdnpu' | tail -40"])
103
 
104
+ section("other FastFlowLM / XRT (Lemonade Server, system packages)")
105
+ if WIN:
106
+ show(["powershell", "-NoProfile", "-Command",
107
+ "Get-Process flm -ErrorAction SilentlyContinue | Select-Object Id,Path | Format-List"])
108
+ else:
109
+ show(["sh", "-c", "ps -eo pid,user,args | grep -E '[f]lm(-real)?( |$)|[l]emonade' || echo 'none running'"])
110
+ show(["sh", "-c", "dpkg -l 'fastflowlm*' 'lemonade*' 'libxrt*' 'xrt*' 'amdxdna*' 2>/dev/null | grep -E '^(ii|rc)' || echo 'no such packages'"])
111
+ show(["sh", "-c", "ls -d /opt/fastflowlm /opt/xilinx/xrt 2>&1"])
112
+
113
  section("FastFlowLM")
114
  cfg = config_dir()
115
  exe_name = "flm.exe" if WIN else "flm"
onw/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
 
3
  LLMs entirely on the AMD Ryzen AI NPU (XDNA2), through FastFlowLM, the NPU-only engine of Lemonade Server.
4
  """
5
- __version__ = "0.1.1"
 
2
 
3
  LLMs entirely on the AMD Ryzen AI NPU (XDNA2), through FastFlowLM, the NPU-only engine of Lemonade Server.
4
  """
5
+ __version__ = "0.1.2"
onw/i18n.json CHANGED
@@ -14,6 +14,7 @@
14
  "NPU でロード中…": "Loading on the NPU…",
15
  "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。": "The NPU check failed (driver {1}). Update the NPU driver and try again.",
16
  "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。": "The NPU firmware is not supported by FastFlowLM. Updating the NPU driver may fix it.",
 
17
  "NPU エンジン": "NPU engine",
18
  "NPU ドライバーが古いです(この PC は {1}、FastFlowLM は {0} 以降が必要)。Windows Update か PC メーカー/AMD のサイトで NPU ドライバーを更新してください。": "The NPU driver is too old (this PC: {1}, FastFlowLM needs {0} or newer). Update the NPU driver with Windows Update or from the PC maker's / AMD's site.",
19
  "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。": "The NPU driver (amdxdna) is too old (this PC: {1}). Update linux-firmware and the amdxdna driver (your distribution's updates, or AMD's guide).",
@@ -50,6 +51,7 @@
50
  "そのモデルはありません": "No such model",
51
  "その都市の人口は?一文で。": "What is that city's population? One sentence.",
52
  "なし": "No",
 
53
  "もう一度チェック": "Check again",
54
  "アンロード": "Unload",
55
  "アンロード(サーバー停止)": "Unload (stop the server)",
@@ -89,7 +91,7 @@
89
  "メッセージを入力するか、画像を添付・貼り付け・ドロップしてください。": "Type a message, or attach, paste or drop an image.",
90
  "メッセージ(Enterで送信、Shift+Enterで改行)": "Message (Enter to send, Shift+Enter for a new line)",
91
  "メモリ 約{0} GB": "memory ~{0} GB",
92
- "メモリのロック上限(memlock)が足りません(Linux)。": "The memory lock limit (memlock) is too low (Linux).",
93
  "メモリ目安": "Memory (est.)",
94
  "モデル": "Models",
95
  "モデルの一覧は、FastFlowLM(約 40 MB)を入れると出ます": "The models are listed once FastFlowLM (about 40 MB) is installed",
@@ -221,6 +223,7 @@
221
  "NPU でロード中…": "正在 NPU 上加载…",
222
  "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。": "NPU 检查失败(驱动 {1})。请更新 NPU 驱动后再试。",
223
  "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。": "NPU 固件不受 FastFlowLM 支持。更新 NPU 驱动可能会解决。",
 
224
  "NPU エンジン": "NPU 引擎",
225
  "NPU ドライバーが古いです(この PC は {1}、FastFlowLM は {0} 以降が必要)。Windows Update か PC メーカー/AMD のサイトで NPU ドライバーを更新してください。": "NPU 驱动过旧(本机为 {1},FastFlowLM 需要 {0} 或更新)。请通过 Windows 更新或电脑厂商/AMD 网站更新 NPU 驱动。",
226
  "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。": "NPU 驱动(amdxdna)过旧(本机为 {1})。请更新 linux-firmware 和 amdxdna 驱动(发行版更新或 AMD 的说明)。",
@@ -257,6 +260,7 @@
257
  "そのモデルはありません": "没有该模型",
258
  "その都市の人口は?一文で。": "那座城市的人口是多少?用一句话回答。",
259
  "なし": "不支持",
 
260
  "もう一度チェック": "重新检查",
261
  "アンロード": "卸载",
262
  "アンロード(サーバー停止)": "卸载(停止服务器)",
@@ -296,7 +300,7 @@
296
  "メッセージを入力するか、画像を添付・貼り付け・ドロップしてください。": "输入消息,或添加、粘贴、拖放图片。",
297
  "メッセージ(Enterで送信、Shift+Enterで改行)": "消息(Enter 发送,Shift+Enter 换行)",
298
  "メモリ 約{0} GB": "内存约 {0} GB",
299
- "メモリのロック上限(memlock)が足りません(Linux)。": "内存锁定上限(memlock)不足(Linux)。",
300
  "メモリ目安": "内存估计",
301
  "モデル": "模型",
302
  "モデルの一覧は、FastFlowLM(約 40 MB)を入れると出ます": "安装 FastFlowLM(约 40 MB)后会列出模型",
 
14
  "NPU でロード中…": "Loading on the NPU…",
15
  "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。": "The NPU check failed (driver {1}). Update the NPU driver and try again.",
16
  "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。": "The NPU firmware is not supported by FastFlowLM. Updating the NPU driver may fix it.",
17
+ "NPU を取り合うので、止めてから使ってください: {0}": "They compete for the NPU; stop it before using onw: {0}",
18
  "NPU エンジン": "NPU engine",
19
  "NPU ドライバーが古いです(この PC は {1}、FastFlowLM は {0} 以降が必要)。Windows Update か PC メーカー/AMD のサイトで NPU ドライバーを更新してください。": "The NPU driver is too old (this PC: {1}, FastFlowLM needs {0} or newer). Update the NPU driver with Windows Update or from the PC maker's / AMD's site.",
20
  "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。": "The NPU driver (amdxdna) is too old (this PC: {1}). Update linux-firmware and the amdxdna driver (your distribution's updates, or AMD's guide).",
 
51
  "そのモデルはありません": "No such model",
52
  "その都市の人口は?一文で。": "What is that city's population? One sentence.",
53
  "なし": "No",
54
+ "ほかの FastFlowLM が動いています(Lemonade Server など)": "Another FastFlowLM is running (Lemonade Server or similar)",
55
  "もう一度チェック": "Check again",
56
  "アンロード": "Unload",
57
  "アンロード(サーバー停止)": "Unload (stop the server)",
 
91
  "メッセージを入力するか、画像を添付・貼り付け・ドロップしてください。": "Type a message, or attach, paste or drop an image.",
92
  "メッセージ(Enterで送信、Shift+Enterで改行)": "Message (Enter to send, Shift+Enter for a new line)",
93
  "メモリ 約{0} GB": "memory ~{0} GB",
94
+ "メモリのロック上限(memlock)が足りません。/etc/security/limits.d/99-onw-amd-memlock.conf に「* soft memlock unlimited」と「* hard memlock unlimited」の 2 行を書き、PC を再起動してください(onw AMD を入れ直すと自動で設定します)。": "The memory lock limit (memlock) is too low. Write the two lines \"* soft memlock unlimited\" and \"* hard memlock unlimited\" to /etc/security/limits.d/99-onw-amd-memlock.conf and restart the PC (installing onw AMD again sets this up).",
95
  "メモリ目安": "Memory (est.)",
96
  "モデル": "Models",
97
  "モデルの一覧は、FastFlowLM(約 40 MB)を入れると出ます": "The models are listed once FastFlowLM (about 40 MB) is installed",
 
223
  "NPU でロード中…": "正在 NPU 上加载…",
224
  "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。": "NPU 检查失败(驱动 {1})。请更新 NPU 驱动后再试。",
225
  "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。": "NPU 固件不受 FastFlowLM 支持。更新 NPU 驱动可能会解决。",
226
+ "NPU を取り合うので、止めてから使ってください: {0}": "它们会争用 NPU,请先停止:{0}",
227
  "NPU エンジン": "NPU 引擎",
228
  "NPU ドライバーが古いです(この PC は {1}、FastFlowLM は {0} 以降が必要)。Windows Update か PC メーカー/AMD のサイトで NPU ドライバーを更新してください。": "NPU 驱动过旧(本机为 {1},FastFlowLM 需要 {0} 或更新)。请通过 Windows 更新或电脑厂商/AMD 网站更新 NPU 驱动。",
229
  "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。": "NPU 驱动(amdxdna)过旧(本机为 {1})。请更新 linux-firmware 和 amdxdna 驱动(发行版更新或 AMD 的说明)。",
 
260
  "そのモデルはありません": "没有该模型",
261
  "その都市の人口は?一文で。": "那座城市的人口是多少?用一句话回答。",
262
  "なし": "不支持",
263
+ "ほかの FastFlowLM が動いています(Lemonade Server など)": "另一个 FastFlowLM 正在运行(Lemonade Server 等)",
264
  "もう一度チェック": "重新检查",
265
  "アンロード": "卸载",
266
  "アンロード(サーバー停止)": "卸载(停止服务器)",
 
300
  "メッセージを入力するか、画像を添付・貼り付け・ドロップしてください。": "输入消息,或添加、粘贴、拖放图片。",
301
  "メッセージ(Enterで送信、Shift+Enterで改行)": "消息(Enter 发送,Shift+Enter 换行)",
302
  "メモリ 約{0} GB": "内存约 {0} GB",
303
+ "メモリのロック上限(memlock)が足りません。/etc/security/limits.d/99-onw-amd-memlock.conf に「* soft memlock unlimited」と「* hard memlock unlimited」の 2 行を書き、PC を再起動してください(onw AMD を入れ直すと自動で設定します)。": "内存锁定上限(memlock)不足。请在 /etc/security/limits.d/99-onw-amd-memlock.conf 中写入“* soft memlock unlimited”和“* hard memlock unlimited”两行,然后重启电脑(重新安装 onw AMD 会自动设置)。",
304
  "メモリ目安": "内存估计",
305
  "モデル": "模型",
306
  "モデルの一覧は、FastFlowLM(約 40 MB)を入れると出ます": "安装 FastFlowLM(约 40 MB)后会列出模型",
onw/lemonade.py CHANGED
@@ -216,6 +216,25 @@ def flm_check(cfg=None):
216
  "detail": detail[-600:]}
217
 
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  def flm_validate(cfg=None):
220
  """(ok, message) from `flm validate --json`."""
221
  c = flm_check(cfg)
 
216
  "detail": detail[-600:]}
217
 
218
 
219
+ def other_flm():
220
+ """Paths of FastFlowLM programs running that are not onw's (Lemonade Server's, a system package's flm serve):
221
+ they hold the NPU, and onw's engine then fails or waits."""
222
+ try:
223
+ import psutil
224
+ except ImportError:
225
+ return []
226
+ mine = os.path.normcase(os.path.abspath(install_dir()))
227
+ out = []
228
+ for p in psutil.process_iter(["name", "exe"]):
229
+ try:
230
+ name, exe = (p.info["name"] or "").lower(), p.info["exe"] or ""
231
+ if name in ("flm", "flm.exe", "flm-real") and not os.path.normcase(os.path.abspath(exe or name)).startswith(mine):
232
+ out.append(exe or name)
233
+ except Exception:
234
+ continue
235
+ return sorted(set(out))
236
+
237
+
238
  def flm_validate(cfg=None):
239
  """(ok, message) from `flm validate --json`."""
240
  c = flm_check(cfg)
onw/manager.py CHANGED
@@ -26,7 +26,7 @@ CHECK_TEXT = { # flm validate's findings ({0}: driver FastFlowLM needs, {1}: d
26
  "firmware": "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。",
27
  "driver_old_linux": "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。",
28
  "kernel": "Linux カーネルが FastFlowLM に対応していません。",
29
- "memlock": "メモリのロック上限(memlock)が足りません(Linux)。",
30
  "failed": "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。",
31
  "error": "FastFlowLM の NPU チェックを実行できませんでした。",
32
  }
@@ -71,6 +71,7 @@ class Manager:
71
  self.check = None
72
  return
73
  c = lemonade.flm_check()
 
74
  n = lemonade.npu()
75
  linux = lambda code: code + "_linux" if not lemonade.WINDOWS and code + "_linux" in CHECK_TEXT else code
76
  c["text"] = [T(CHECK_TEXT.get(linux(code), CHECK_TEXT["failed"]), lemonade.MIN_DRIVER, n.get("driver") or "?")
@@ -121,8 +122,8 @@ class Manager:
121
  "engine_dl": {"frac": eng_dl["frac"], "text": eng_dl["text"], "error": eng_dl.get("error"),
122
  "done": bool(eng_dl.get("done"))} if eng_dl else None,
123
  "flm_error": app._FLM_CACHE.get("error", ""),
124
- "npu_check": {"ok": self.check["ok"], "text": self.check["text"], "detail": self.check["detail"]}
125
- if self.check else None,
126
  "server": {"status": status, "model": info and info.get("model"), "path": info and info.get("path"),
127
  "error": app.failure_reason() if status == "failed" else "",
128
  "title": app.model_title(info["model"]) if info else None, "port": info and info.get("port"),
 
26
  "firmware": "NPU のファームウェアが FastFlowLM に対応していません。NPU ドライバーを更新すると直ることがあります。",
27
  "driver_old_linux": "NPU ドライバー(amdxdna)が古いです(この PC は {1})。linux-firmware と amdxdna ドライバーを新しくしてください(ディストリビューションの更新、または AMD の案内)。",
28
  "kernel": "Linux カーネルが FastFlowLM に対応していません。",
29
+ "memlock": "メモリのロック上限(memlock)が足りません。/etc/security/limits.d/99-onw-amd-memlock.conf に「* soft memlock unlimited」と「* hard memlock unlimited」の 2 行を書き、PC を再起動してください(onw AMD を入れ直すと自動で設定します)。",
30
  "failed": "NPU のチェックに失敗しました(ドライバー {1})。NPU ドライバーを更新してから、もう一度試してください。",
31
  "error": "FastFlowLM の NPU チェックを実行できませんでした。",
32
  }
 
71
  self.check = None
72
  return
73
  c = lemonade.flm_check()
74
+ c["others"] = lemonade.other_flm()
75
  n = lemonade.npu()
76
  linux = lambda code: code + "_linux" if not lemonade.WINDOWS and code + "_linux" in CHECK_TEXT else code
77
  c["text"] = [T(CHECK_TEXT.get(linux(code), CHECK_TEXT["failed"]), lemonade.MIN_DRIVER, n.get("driver") or "?")
 
122
  "engine_dl": {"frac": eng_dl["frac"], "text": eng_dl["text"], "error": eng_dl.get("error"),
123
  "done": bool(eng_dl.get("done"))} if eng_dl else None,
124
  "flm_error": app._FLM_CACHE.get("error", ""),
125
+ "npu_check": {"ok": self.check["ok"], "text": self.check["text"], "detail": self.check["detail"],
126
+ "others": self.check["others"]} if self.check else None,
127
  "server": {"status": status, "model": info and info.get("model"), "path": info and info.get("path"),
128
  "error": app.failure_reason() if status == "failed" else "",
129
  "title": app.model_title(info["model"]) if info else None, "port": info and info.get("port"),
onw/web/manage.html CHANGED
@@ -312,12 +312,14 @@
312
  $("b-load").disabled = same || !pick.value || st === "loading";
313
  // models table
314
  $("npuwarn").style.display = s.npu && !s.npu_ok ? "" : "none";
315
- const ck = s.npu_check, ckHtml = ck && !ck.ok
316
- ? `<b>${T("FastFlowLM の NPU チェックで止まりました")}</b><br>${ck.text.map(esc).join("<br>")}` +
 
 
317
  `<br><button class="ghost" onclick="post('open',{what:'driver'})">${T("ドライバーの入れ方")}</button>` +
318
  `<button class="ghost" onclick="post('open',{what:'recheck'})">${T("もう一度チェック")}</button>` +
319
  (ck.detail ? `<details><summary>${T("詳しい結果(flm validate)")}</summary><pre class="mono" style="white-space:pre-wrap;margin:4px 0 0">${esc(ck.detail)}</pre></details>` : "")
320
- : "";
321
  if ($("checkwarn").innerHTML !== ckHtml) $("checkwarn").innerHTML = ckHtml;
322
  $("checkwarn").style.display = ckHtml ? "" : "none";
323
  $("seng").textContent = "FastFlowLM " + (s.engine.installed || T("未インストール"));
 
312
  $("b-load").disabled = same || !pick.value || st === "loading";
313
  // models table
314
  $("npuwarn").style.display = s.npu && !s.npu_ok ? "" : "none";
315
+ const ck = s.npu_check, others = ck && ck.others && ck.others.length
316
+ ? `<b>${T("ほかの FastFlowLM が動いています(Lemonade Server など)")}</b><br>${T("NPU を取り合うので、止めてから使ってください: {0}", ck.others.join(", "))}<br>` : "";
317
+ const ckHtml = ck && !ck.ok
318
+ ? others + `<b>${T("FastFlowLM の NPU チェックで止まりました")}</b><br>${ck.text.map(esc).join("<br>")}` +
319
  `<br><button class="ghost" onclick="post('open',{what:'driver'})">${T("ドライバーの入れ方")}</button>` +
320
  `<button class="ghost" onclick="post('open',{what:'recheck'})">${T("もう一度チェック")}</button>` +
321
  (ck.detail ? `<details><summary>${T("詳しい結果(flm validate)")}</summary><pre class="mono" style="white-space:pre-wrap;margin:4px 0 0">${esc(ck.detail)}</pre></details>` : "")
322
+ : others ? others + `<button class="ghost" onclick="post('open',{what:'recheck'})">${T("もう一度チェック")}</button>` : "";
323
  if ($("checkwarn").innerHTML !== ckHtml) $("checkwarn").innerHTML = ckHtml;
324
  $("checkwarn").style.display = ckHtml ? "" : "none";
325
  $("seng").textContent = "FastFlowLM " + (s.engine.installed || T("未インストール"));
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
 
5
  [project]
6
  name = "onw-amd"
7
- version = "0.1.1"
8
  description = "Ore no NPU ga konna ni ugoku wake nai - LLMs entirely on the AMD Ryzen AI NPU (FastFlowLM, as in Lemonade Server)"
9
  readme = "README.md"
10
  license = {text = "Apache-2.0"}
 
4
 
5
  [project]
6
  name = "onw-amd"
7
+ version = "0.1.2"
8
  description = "Ore no NPU ga konna ni ugoku wake nai - LLMs entirely on the AMD Ryzen AI NPU (FastFlowLM, as in Lemonade Server)"
9
  readme = "README.md"
10
  license = {text = "Apache-2.0"}
setup.sh CHANGED
@@ -26,6 +26,20 @@ if [ -n "$need" ]; then
26
  sudo apt-get install -y $need
27
  fi
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  install_onw() {
30
  # the bundled pip is fine (a newer pip once failed to install packages that have scripts, so it is not upgraded)
31
  .venv/bin/python -m pip install -e ".[tray]"
@@ -60,5 +74,12 @@ Categories=Utility;
60
  EOF
61
  echo "[setup] application list: onw AMD"
62
 
 
 
 
 
 
 
 
63
  echo "[start] onw AMD is starting in the top bar ..."
64
  nohup .venv/bin/onw tray >/dev/null 2>&1 &
 
26
  sudo apt-get install -y $need
27
  fi
28
 
29
+ # FastFlowLM needs a high memlock limit on Linux (its own guide: unlimited, then reboot); Ubuntu's default fails
30
+ # `flm validate`. limits.d covers PAM logins, the systemd drop-ins the desktop session and its apps.
31
+ relogin=""
32
+ if [ "$(ulimit -l)" != "unlimited" ] && [ ! -f /etc/security/limits.d/99-onw-amd-memlock.conf ]; then
33
+ echo "[setup] raising the memlock limit for the NPU (FastFlowLM needs it; asks for sudo)"
34
+ printf '* soft memlock unlimited\n* hard memlock unlimited\n' |
35
+ sudo tee /etc/security/limits.d/99-onw-amd-memlock.conf >/dev/null
36
+ for d in system user; do
37
+ sudo mkdir -p /etc/systemd/$d.conf.d
38
+ printf '[Manager]\nDefaultLimitMEMLOCK=infinity\n' | sudo tee /etc/systemd/$d.conf.d/99-onw-amd-memlock.conf >/dev/null
39
+ done
40
+ relogin=1
41
+ fi
42
+
43
  install_onw() {
44
  # the bundled pip is fine (a newer pip once failed to install packages that have scripts, so it is not upgraded)
45
  .venv/bin/python -m pip install -e ".[tray]"
 
74
  EOF
75
  echo "[setup] application list: onw AMD"
76
 
77
+ if [ -n "$relogin" ]; then
78
+ echo
79
+ echo "[setup] The memlock limit was raised. Restart the PC once so that the NPU can be used,"
80
+ echo " then start onw AMD from the application list."
81
+ exit 0
82
+ fi
83
+
84
  echo "[start] onw AMD is starting in the top bar ..."
85
  nohup .venv/bin/onw tray >/dev/null 2>&1 &