Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: show the installed Lemonade and FastFlowLM versions on the NPU (#13151)
oobabooga38f3a6140939
diff --git a/studio/backend/core/inference/npu_backend.py b/studio/backend/core/inference/npu_backend.pyindex a8e8bc2bc82..26d45ef107d 100644--- a/studio/backend/core/inference/npu_backend.py+++ b/studio/backend/core/inference/npu_backend.py@@ -238,6 +238,8 @@ class LemonadeNpuBackend:self._validation: Optional[dict[str, Any]] = Noneself._state = "idle"self._error: Optional[str] = None+ self._flm_version_cache: Optional[tuple[tuple[str, int, int], Optional[str]]] = None+ self._last_versions: dict[str, Optional[str]] = {"lemonade": None, "fastflowlm": None}@propertydef root(self) -> Path:@@ -312,8 +314,8 @@ class LemonadeNpuBackend:validated = self._validated_install()return binary is None and isinstance(validated, str) and bool(validated)- def _flm_version(self) -> Optional[str]:- binary = self._flm_binary()+ def _flm_version(self, binary: Optional[Path] = None) -> Optional[str]:+ binary = binary or self._flm_binary()if binary is None:return Noneenv = child_env_without_native_path_secret()@@ -336,16 +338,61 @@ class LemonadeNpuBackend:return Nonereturn str(version).lstrip("v") if version else None+ def _installed_flm_version(self) -> Optional[str]:+ binary = self._flm_binary()+ if binary is None:+ return None+ try:+ stat = binary.stat()+ except OSError:+ return None+ key = (str(binary), stat.st_mtime_ns, stat.st_size)+ cached = self._flm_version_cache+ if cached is not None and cached[0] == key:+ return cached[1]+ # Failures are cached too, so a mute binary is not rerun per status read.+ version = self._flm_version(binary)+ self._flm_version_cache = (key, version)+ return version++ def _installed_lemonade_version(self, lemond: Optional[Path]) -> Optional[str]:+ if lemond is None:+ return None+ try:+ return _installer_module().installed_version(lemond)+ except Exception as exc: # noqa: BLE001 -- a missing version never hides the status+ logger.warning("Could not read the Lemonade version: %s", exc)+ return None++ def _versions(+ self, binary: Optional[Path], validated: Optional[str]+ ) -> dict[str, Optional[str]]:+ # Non-blocking: Enable replaces flm under this lock (a running flm blocks that on Windows).+ if not self._lock.acquire(blocking = False):+ return dict(self._last_versions)+ try:+ lemond = binary or (+ Path(validated) if isinstance(validated, str) and validated else None+ )+ self._last_versions = {+ "lemonade": self._installed_lemonade_version(lemond),+ "fastflowlm": self._installed_flm_version(),+ }+ return dict(self._last_versions)+ finally:+ self._lock.release()+def status(self) -> dict[str, Any]:hardware = self.hardware()binary = self._installed_lemond()+ validated = self._validated_install()# An enabled NPU stays enabled across a pin change: its first use upgrades the runtime.upgrade_pending = self._state == "idle" and self._upgrade_pending(binary)installed = binary is not None or upgrade_pendingready = (self._state == "ready"or upgrade_pending- or (self._state == "idle" and installed and self._validated_install() == str(binary))+ or (self._state == "idle" and installed and validated == str(binary)))running = self._server is not None and self._server.is_alive()resident = self.resident()@@ -363,6 +410,7 @@ class LemonadeNpuBackend:"loaded_model": resident.model.model_path if resident else None,"context_length": resident.context_length if resident else None,"loading_model": self._loading,+ "versions": self._versions(binary, validated),}def _server_for(self, binary: Path) -> LemonadeServer:diff --git a/studio/backend/routes/npu.py b/studio/backend/routes/npu.pyindex 93531e0d999..ab258bbf8d3 100644--- a/studio/backend/routes/npu.py+++ b/studio/backend/routes/npu.py@@ -39,6 +39,7 @@ _MANAGED_ACCOUNT_STATUS = {"loaded_model": None,"context_length": None,"loading_model": None,+ "versions": {"lemonade": None, "fastflowlm": None},}diff --git a/studio/backend/tests/test_npu_backend.py b/studio/backend/tests/test_npu_backend.pyindex 6d0605791e8..5490c8feca8 100644--- a/studio/backend/tests/test_npu_backend.py+++ b/studio/backend/tests/test_npu_backend.py@@ -507,6 +507,100 @@ def test_an_enabled_npu_upgrades_on_first_use_after_the_pins_move(npu, monkeypatassert again.status()["ready"] is True+def test_the_status_names_the_installed_runtime_versions(npu, monkeypatch):+ monkeypatch.setenv("FAKE_FLM_VERSION", "v1.0.7")+ npu.installer.installed_version = lambda lemond: "2026.41.1"+ real, runs = npu._flm_version, []+ monkeypatch.setattr(npu, "_flm_version", lambda *args: runs.append(1) or real(*args))+ npu.enable()+ assert npu.status()["versions"] == {"lemonade": "2026.41.1", "fastflowlm": "1.0.7"}+ npu.status()+ # The post-install check, then one status read: an unchanged flm binary is not rerun.+ assert len(runs) == 2+++def test_a_pending_upgrade_reports_the_versions_it_replaces_until_first_use(npu, monkeypatch):+ monkeypatch.setenv("FAKE_FLM_VERSION", "1.0.3")+ restarted = _move_the_pins(npu, monkeypatch)+ restarted.installer.installed_version = lambda lemond: (+ "2026.41.1" if restarted.installer.current else "11.9.0"+ )+ try:+ assert restarted.status()["versions"] == {"lemonade": "11.9.0", "fastflowlm": "1.0.3"}+ monkeypatch.setenv("FAKE_FLM_VERSION", "1.0.7")+ restarted.catalog()+ assert restarted.status()["versions"] == {"lemonade": "2026.41.1", "fastflowlm": "1.0.7"}+ finally:+ restarted.shutdown()+++def _enable_in_background(npu):+ import threading++ thread = threading.Thread(target = npu.enable, daemon = True)+ thread.start()+ return thread+++def test_enable_waits_for_a_version_probe_already_running(npu, monkeypatch):+ import threading++ monkeypatch.setenv("FAKE_LEMOND_INSTALL_SECONDS", "3")+ npu.enable()+ npu._flm_version_cache = None+ probing, release, state_at_probe_end = threading.Event(), threading.Event(), []+ real = npu._flm_version++ def slow_probe(*args):+ if threading.current_thread().name == "status-reader":+ probing.set()+ release.wait(30)+ state_at_probe_end.append(npu._state)+ return real(*args)++ monkeypatch.setattr(npu, "_flm_version", slow_probe)+ reader = threading.Thread(target = npu.status, name = "status-reader", daemon = True)+ reader.start()+ assert probing.wait(30)+ enabling = _enable_in_background(npu)+ # Without the lock, Enable reaches the FastFlowLM install within these polls.+ for _ in range(40):+ if npu._state != "ready":+ break+ time.sleep(0.05)+ release.set()+ reader.join(30)+ enabling.join(60)+ assert state_at_probe_end == ["ready"]+ assert npu.status()["state"] == "ready"+++def test_a_status_read_during_enable_runs_no_probe_and_keeps_the_last_versions(npu, monkeypatch):+ import threading++ monkeypatch.setenv("FAKE_FLM_VERSION", "1.0.7")+ monkeypatch.setenv("FAKE_LEMOND_INSTALL_SECONDS", "3")+ npu.installer.installed_version = lambda lemond: "11.9.0"+ npu.enable()+ assert npu.status()["versions"] == {"lemonade": "11.9.0", "fastflowlm": "1.0.7"}+ npu._flm_version_cache = None+ real, probes = npu._flm_version, []++ def counted(*args):+ probes.append(threading.current_thread().name)+ return real(*args)++ monkeypatch.setattr(npu, "_flm_version", counted)+ enabling = _enable_in_background(npu)+ _wait_until(lambda: npu._state == "installing_flm")+ status = npu.status()+ assert status["state"] == "installing_flm"+ assert status["versions"] == {"lemonade": "11.9.0", "fastflowlm": "1.0.7"}+ assert threading.current_thread().name not in probes+ enabling.join(60)+ assert npu.status()["state"] == "ready"++def test_an_upgrade_that_fails_validation_asks_to_try_again(npu, monkeypatch):restarted = _move_the_pins(npu, monkeypatch)try:diff --git a/studio/frontend/src/features/hub/catalog/npu-catalog-list.tsx b/studio/frontend/src/features/hub/catalog/npu-catalog-list.tsxindex 30e9fd02648..05fa11dbf5c 100644--- a/studio/frontend/src/features/hub/catalog/npu-catalog-list.tsx+++ b/studio/frontend/src/features/hub/catalog/npu-catalog-list.tsx@@ -6,6 +6,7 @@ import { Spinner } from "@/components/ui/spinner";import {type NpuModel,type NpuPickerSource,+ NpuPoweredBy,NpuSetupNotice,npuDownloadLabel,npuResumeLabel,@@ -70,6 +71,9 @@ export function NpuCatalogList({data-testid="hub-npu-catalog"className="mx-auto flex min-h-0 w-full max-w-[var(--hub-measure)] flex-1 flex-col gap-0.5 overflow-y-auto px-3 py-3">+ {catalog.ready ? (+ <NpuPoweredBy status={catalog.status} className="px-3 pb-2" />+ ) : null}{body()}</div>);diff --git a/studio/frontend/src/features/npu/api.ts b/studio/frontend/src/features/npu/api.tsindex e1f3ae2b9bf..174ca5942f5 100644--- a/studio/frontend/src/features/npu/api.ts+++ b/studio/frontend/src/features/npu/api.ts@@ -43,6 +43,8 @@ export interface NpuStatus {loaded_model: string | null;context_length: number | null;loading_model: string | null;+ /** Installed runtime versions; absent from servers that predate them. */+ versions?: { lemonade: string | null; fastflowlm: string | null };}export interface NpuModel {diff --git a/studio/frontend/src/features/npu/index.ts b/studio/frontend/src/features/npu/index.tsindex f298794e5a1..0c7263e398e 100644--- a/studio/frontend/src/features/npu/index.ts+++ b/studio/frontend/src/features/npu/index.ts@@ -12,7 +12,7 @@ export {npuRowsFor,npuSizeLabel,} from "./api";-export { NpuSetupNotice } from "./npu-setup-notice";+export { NpuPoweredBy, NpuSetupNotice } from "./npu-setup-notice";export {type NpuCatalog,type NpuPickerSource,diff --git a/studio/frontend/src/features/npu/npu-setup-notice.tsx b/studio/frontend/src/features/npu/npu-setup-notice.tsxindex 64c90541166..688f32c964c 100644--- a/studio/frontend/src/features/npu/npu-setup-notice.tsx+++ b/studio/frontend/src/features/npu/npu-setup-notice.tsx@@ -3,8 +3,10 @@import { Button } from "@/components/ui/button";import { Spinner } from "@/components/ui/spinner";+import { cn } from "@/lib/utils";import { AlertCircleIcon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";+import type { NpuStatus } from "./api";import type { NpuCatalog } from "./use-npu-catalog";export function NpuSetupNotice({ catalog }: { catalog: NpuCatalog }) {@@ -61,27 +63,45 @@ export function NpuSetupNotice({ catalog }: { catalog: NpuCatalog }) {<Spinner className="size-3.5 text-muted-foreground" /></div>) : null}- <p className="text-ui-11 text-muted-foreground">- Powered by{" "}- <a- href="https://github.com/ROCm/FastFlowLM"- target="_blank"- rel="noreferrer"- className="underline underline-offset-2"- >- FastFlowLM- </a>{" "}- and{" "}- <a- href="https://github.com/lemonade-sdk/lemonade"- target="_blank"- rel="noreferrer"- className="underline underline-offset-2"- >- Lemonade- </a>- .- </p>+ <NpuPoweredBy status={status} /></div>);}++const version = (value: string | null | undefined) =>+ value ? ` v${value}` : "";++export function NpuPoweredBy({+ status,+ className,+}: {+ status: NpuStatus;+ className?: string;+}) {+ return (+ <p+ data-testid="npu-powered-by"+ className={cn("text-ui-11 text-muted-foreground", className)}+ >+ Powered by{" "}+ <a+ href="https://github.com/ROCm/FastFlowLM"+ target="_blank"+ rel="noreferrer"+ className="underline underline-offset-2"+ >+ FastFlowLM+ </a>+ {version(status.versions?.fastflowlm)} and{" "}+ <a+ href="https://github.com/lemonade-sdk/lemonade"+ target="_blank"+ rel="noreferrer"+ className="underline underline-offset-2"+ >+ Lemonade+ </a>+ {version(status.versions?.lemonade)}.+ </p>+ );+}diff --git a/studio/frontend/src/features/npu/use-npu-catalog.ts b/studio/frontend/src/features/npu/use-npu-catalog.tsindex deda0609b09..5d0c33b6251 100644--- a/studio/frontend/src/features/npu/use-npu-catalog.ts+++ b/studio/frontend/src/features/npu/use-npu-catalog.ts@@ -54,14 +54,13 @@ export function useNpuCatalog(useEffect(() => {if (!ready) return;- // This listing can run a pending upgrade; on failure re-read status to offer Try again.- void refreshNpuModels().then((listed) => {- if (listed) return;+ // This listing can run a pending upgrade: re-read status for its versions, or for Try again.+ void refreshNpuModels().then(() =>getNpuStatus().then((next) => statusChange.current?.(next),() => undefined,- );- });+ ),+ );listNpuDownloads().then((running) => {for (const { model, percent } of running) {diff --git a/studio/install_lemonade_prebuilt.py b/studio/install_lemonade_prebuilt.pyindex d7125fc0704..f524b9d8724 100644--- a/studio/install_lemonade_prebuilt.py+++ b/studio/install_lemonade_prebuilt.py@@ -71,6 +71,14 @@ def install_dir(root: Path, pins: Optional[dict] = None) -> Path:return Path(root) / pins["lemonade"]["version"]+def _read_marker(directory: Path) -> Optional[dict]:+ try:+ marker = json.loads((directory / MARKER_NAME).read_text(encoding = "utf-8"))+ except (OSError, ValueError):+ return None+ return marker if isinstance(marker, dict) else None++def installed_lemond(root: Path, pins: Optional[dict] = None) -> Optional[Path]:"""The lemond binary of a complete install matching the pin, else None."""pins = pins or load_pins()@@ -78,9 +86,8 @@ def installed_lemond(root: Path, pins: Optional[dict] = None) -> Optional[Path]:if key is None:return Nonetarget = install_dir(root, pins)- try:- marker = json.loads((target / MARKER_NAME).read_text(encoding = "utf-8"))- except (OSError, ValueError):+ marker = _read_marker(target)+ if marker is None:return Noneasset = pins["lemonade"]["assets"][key]if marker.get("sha256") != asset["sha256"] or marker.get("asset") != asset["name"]:@@ -92,6 +99,13 @@ def installed_lemond(root: Path, pins: Optional[dict] = None) -> Optional[Path]:return binary if binary.is_file() else None+def installed_version(lemond: Path) -> Optional[str]:+ """The Lemonade version recorded beside an installed lemond, or None."""+ marker = _read_marker(lemond.parent)+ version = marker.get("version") if marker else None+ return str(version) if version else None++def _download(url: str,destination: Path,diff --git a/tests/studio/install/test_install_lemonade_prebuilt.py b/tests/studio/install/test_install_lemonade_prebuilt.pyindex 744cac05753..96049aac4fc 100644--- a/tests/studio/install/test_install_lemonade_prebuilt.py+++ b/tests/studio/install/test_install_lemonade_prebuilt.py@@ -112,6 +112,8 @@ def test_install_verifies_and_pins_fastflowlm(tmp_path, served):"fastflowlm.tar.gz": "sha256:" + "ab" * 32}assert "other/repo" in versions["checksums"]["github"]+ assert lp.installed_version(binary) == "9.9.9"+ assert lp.installed_version(tmp_path / "elsewhere" / "lemond") is Nonedef test_a_complete_install_is_not_downloaded_again(tmp_path, served):