add image generation component with prompt enhancement and dynamic backend synchronization
This commit is contained in:
1 parent
45540aee29
commit
1d28391243
2 files changed
+23
-3
No files matched your search
@@ -294,6 +294,19 @@ function Generator({
|
||||
const step = decoding ? (progress.steps || constraints.steps || 20) : (progress.step || 0);
|
||||
const steps = progress.steps || constraints.steps || 20;
|
||||
const speed = decoding ? "" : (progress.speed || "");
|
||||
const numericSpeed = parseFloat(speed);
|
||||
const backendMode = String(progress.backendMode || "").toLowerCase();
|
||||
const backendDevice = String(progress.backendDevice || "").toLowerCase();
|
||||
const isConfirmedGpuBackend = (
|
||||
backendMode.includes("gpu") ||
|
||||
backendMode.includes("vulkan") ||
|
||||
backendMode.includes("cuda") ||
|
||||
backendMode.includes("rocm") ||
|
||||
backendMode.includes("metal") ||
|
||||
backendDevice.includes("vulkan") ||
|
||||
backendDevice.includes("cuda") ||
|
||||
backendDevice.includes("rocm")
|
||||
);
|
||||
|
||||
if (decoding || progress.steps > 0) {
|
||||
hasRealGenerationStepRef.current = true;
|
||||
@@ -324,7 +337,6 @@ function Generator({
|
||||
if (decoding) {
|
||||
remaining = 3;
|
||||
} else {
|
||||
const numericSpeed = parseFloat(speed);
|
||||
if (!isNaN(numericSpeed) && numericSpeed > 0) {
|
||||
const remainingSteps = Math.max(0, steps - step);
|
||||
if (speed.includes("it/s")) {
|
||||
@@ -339,7 +351,7 @@ function Generator({
|
||||
}
|
||||
|
||||
// Detect CPU fallback / slow generation if GPU was requested but it runs slow
|
||||
if (gpuSelected && !cpuFallbackDetected) {
|
||||
if (gpuSelected && !cpuFallbackDetected && !isConfirmedGpuBackend) {
|
||||
const isSlowItS = speed.includes("it/s") && numericSpeed < 0.2;
|
||||
const isSlowSIt = speed.includes("s/it") && numericSpeed > 5.0;
|
||||
if (isSlowItS || isSlowSIt) {
|
||||
|
||||
@@ -4914,6 +4914,8 @@ let generationState = {
|
||||
steps: 0,
|
||||
speed: "",
|
||||
decoding: false,
|
||||
backendMode: "",
|
||||
backendDevice: "",
|
||||
};
|
||||
|
||||
function resetGenerationState() {
|
||||
@@ -4923,6 +4925,8 @@ function resetGenerationState() {
|
||||
steps: 0,
|
||||
speed: "",
|
||||
decoding: false,
|
||||
backendMode: "",
|
||||
backendDevice: "",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6693,7 +6697,11 @@ async function getLlmfitRecommendations(useCase = "chat", limit = 10) {
|
||||
|
||||
// GET /api/generation-progress
|
||||
if (req.url === "/api/generation-progress" && req.method === "GET") {
|
||||
return json(res, 200, generationState);
|
||||
return json(res, 200, {
|
||||
...generationState,
|
||||
backendMode: generationState.backendMode || currentSettings.backendMode || "",
|
||||
backendDevice: generationState.backendDevice || currentSettings.backendDevice || "",
|
||||
});
|
||||
}
|
||||
|
||||
if (req.url === "/api/openvino-generate" && req.method === "POST") {
|
||||
|
||||
Reference in new issue
Block a user