fix: resolve OpenVINO NPU and GPU backend switching/loading transition issues

This commit is contained in:
techjarves committed 2026-06-13 15:45:16 +05:30
1 parent d4cdc6ae28
commit 0beaeab414
4 files changed
+10 -9

No files matched your search

+1 -1
View File
@@ -139,7 +139,7 @@ function Generator({
crashError = status.error;
break;
}
if (!status.running && i > 3) {
if (!status.running && !status.loading?.active && i > 3) {
crashError = "The backend process terminated immediately on startup.";
break;
}
@@ -86,18 +86,17 @@ function ImageConstraints({
const currentBackend = constraints.backendType || "cpu";
if (backendType === currentBackend) return;
const isGpuBackend = (type) => !["cpu", "openvino-npu"].includes(type);
const switchesAccelerator =
(currentBackend === "openvino-npu" && isGpuBackend(backendType)) ||
(isGpuBackend(currentBackend) && backendType === "openvino-npu");
(currentBackend === "openvino-npu" && backendType !== "openvino-npu") ||
(currentBackend !== "openvino-npu" && backendType === "openvino-npu");
if (serverRunning && switchesAccelerator) {
const leavingNpu = currentBackend === "openvino-npu";
const confirmed = await showConfirm({
title: leavingNpu ? "Unload NPU Model?" : "Unload GPU Model?",
title: leavingNpu ? "Unload NPU Model?" : "Unload Model?",
message: leavingNpu
? "The OpenVINO NPU model must be unloaded before switching to the GPU backend."
: "The GPU model must be unloaded before switching to the OpenVINO NPU backend.",
? "The OpenVINO NPU model must be unloaded before switching to the standard backend."
: "The active model must be unloaded before switching to the OpenVINO NPU backend.",
confirmLabel: "Unload",
cancelLabel: "Cancel",
danger: true,
+4 -2
View File
@@ -332,7 +332,9 @@ function ModelManager({ activeModel, setActiveModel, serverRunning, setServerRun
let isReady = false;
let crashError = null;
for (let i = 0; i < 240; i++) { // Poll for up to 120 seconds (240 * 500ms)
const isOpenVinoModel = modelInfo?.backendType === "openvino-npu";
const maxStartupPolls = isOpenVinoModel ? 1200 : 240;
for (let i = 0; i < maxStartupPolls; i++) {
const status = await getBackendStatus();
if (status.loading) {
setModelLoadProgress({
@@ -355,7 +357,7 @@ function ModelManager({ activeModel, setActiveModel, serverRunning, setServerRun
crashError = status.error;
break;
}
if (!status.running && i > 3) {
if (!status.running && !status.loading?.active && i > 3) {
crashError = "The backend process terminated immediately on startup.";
break;
}