mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
fix progress in legacy tabs
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+1
-1
Submodule extensions-builtin/sdnq updated: 79a4c00d1b...026f1cbc46
@@ -29,8 +29,9 @@ def start_progress(name: str, total: int):
|
||||
return None, None
|
||||
from rich.progress import Progress, TextColumn, BarColumn, TaskProgressColumn, TimeRemainingColumn, TimeElapsedColumn
|
||||
progress = Progress(TextColumn('[cyan]{task.description}'), BarColumn(), TaskProgressColumn(), TimeRemainingColumn(), TimeElapsedColumn(), console=console, transient=True)
|
||||
task = progress.add_task(description=f'Autotune: kernel={name}', total=total)
|
||||
progress.start()
|
||||
return progress, progress.add_task(description=f'Autotune kernel: {name}', total=total)
|
||||
return progress, task
|
||||
|
||||
|
||||
def stop_progress(session):
|
||||
@@ -57,7 +58,7 @@ def bench_hook(orig):
|
||||
session['count'] += 1
|
||||
if session['progress'] is not None:
|
||||
session['progress'].update(session['task'], completed=session['count'])
|
||||
shared.state.textinfo = f"Tuning kernel {session['name']} {session['count']}/{session['total']} (one-time per shape)"
|
||||
shared.state.textinfo = f"Tuning kernel {session['name']} {session['count']}/{session['total']}"
|
||||
except Exception as e:
|
||||
log.debug(f'Kernel autotune: report error: {e}')
|
||||
return orig(self, *args, config=config, **meta)
|
||||
@@ -79,7 +80,7 @@ def make_autotune_listener(prior):
|
||||
log.debug(f'Kernel autotune: kernel={name} shape={shape} cached')
|
||||
else:
|
||||
compile_s = (session['compile_us'] / 1e6) if session is not None else 0
|
||||
log.info(f'Kernel autotune: kernel={name} shape={shape} time={duration or 0:.2f} compile={compile_s:.2f}')
|
||||
log.debug(f'Kernel autotune: kernel={name} shape={shape} time={duration or 0:.2f} compile={compile_s:.2f}')
|
||||
except Exception as e:
|
||||
log.debug(f'Kernel autotune: report error: {e}')
|
||||
if prior is not None:
|
||||
|
||||
Vendored
+21
-6
@@ -11118,9 +11118,10 @@ function requestProgress(id_task = "undefined", progressEl = null, galleryEl = n
|
||||
livePreview.appendChild(img);
|
||||
img.onload = () => {
|
||||
img.style.width = `min(100%, max(${img.naturalWidth}px, 512px))`;
|
||||
parentGallery.style.minHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
parentGallery.style.maxHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
parentGallery.style.overflow = "hidden";
|
||||
const anchored = livePreview.parentElement === parentGallery;
|
||||
if (anchored) {
|
||||
parentGallery.style.overflow = "hidden";
|
||||
}
|
||||
};
|
||||
};
|
||||
const removeLivePreview = (useImage = false) => {
|
||||
@@ -11141,8 +11142,6 @@ function requestProgress(id_task = "undefined", progressEl = null, galleryEl = n
|
||||
parentGallery.removeChild(livePreview);
|
||||
}
|
||||
if (parentGallery) {
|
||||
parentGallery.style.minHeight = "unset";
|
||||
parentGallery.style.maxHeight = "unset";
|
||||
parentGallery.style.overflow = "unset";
|
||||
}
|
||||
} catch {
|
||||
@@ -11223,6 +11222,21 @@ window.requestInterrupt = requestInterrupt;
|
||||
window.randomId = randomId;
|
||||
window.requestProgress = requestProgress;
|
||||
|
||||
// ui/dynamicUI.ts
|
||||
var lastCheckpoint = "";
|
||||
async function updateUI(model) {
|
||||
if (model.checkpoint === lastCheckpoint) return;
|
||||
lastCheckpoint = model.checkpoint;
|
||||
log("modelUpdate", model);
|
||||
}
|
||||
async function updateModel() {
|
||||
const req = await authFetch2(`${window.api}/checkpoint`);
|
||||
if (req.ok) {
|
||||
const model = await req.json();
|
||||
if (model?.type?.length > 0) updateUI(model);
|
||||
}
|
||||
}
|
||||
|
||||
// ui/ui.ts
|
||||
window.opts = {};
|
||||
window.localization = {};
|
||||
@@ -11815,11 +11829,12 @@ async function reconnectUI() {
|
||||
const sd_model = gradioApp().getElementById("setting_sd_model_checkpoint");
|
||||
let loadingStarted = 0;
|
||||
let loadingMonitor = null;
|
||||
const sd_model_callback = () => {
|
||||
const sd_model_callback = async () => {
|
||||
const loading = sd_model.querySelector(".eta-bar");
|
||||
if (!loading) {
|
||||
loadingStarted = 0;
|
||||
clearInterval(loadingMonitor);
|
||||
updateModel();
|
||||
} else if (loadingStarted === 0) {
|
||||
loadingStarted = Date.now();
|
||||
loadingMonitor = setInterval(() => {
|
||||
|
||||
Vendored
+4
-4
File diff suppressed because one or more lines are too long
@@ -0,0 +1,25 @@
|
||||
import { log } from './logger';
|
||||
import { authFetch } from './authWrap';
|
||||
|
||||
interface Model {
|
||||
type: string;
|
||||
class: string;
|
||||
checkpoint: string;
|
||||
title: string;
|
||||
name: string;
|
||||
}
|
||||
let lastCheckpoint = '';
|
||||
|
||||
async function updateUI(model: Model) {
|
||||
if (model.checkpoint === lastCheckpoint) return;
|
||||
lastCheckpoint = model.checkpoint;
|
||||
log('modelUpdate', model);
|
||||
}
|
||||
|
||||
export async function updateModel() {
|
||||
const req = await authFetch(`${window.api}/checkpoint`);
|
||||
if (req.ok) {
|
||||
const model = await req.json() as Model;
|
||||
if (model?.type?.length > 0) updateUI(model);
|
||||
}
|
||||
}
|
||||
+8
-5
@@ -143,9 +143,12 @@ export function requestProgress(id_task = 'undefined', progressEl = null, galler
|
||||
livePreview.appendChild(img);
|
||||
img.onload = () => {
|
||||
img.style.width = `min(100%, max(${img.naturalWidth}px, 512px))`;
|
||||
parentGallery.style.minHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
parentGallery.style.maxHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
parentGallery.style.overflow = 'hidden';
|
||||
const anchored = livePreview.parentElement === parentGallery;
|
||||
if (anchored) {
|
||||
// parentGallery.style.minHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
// parentGallery.style.maxHeight = `min(82vh, ${img.naturalHeight}px)`;
|
||||
parentGallery.style.overflow = 'hidden';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -167,8 +170,8 @@ export function requestProgress(id_task = 'undefined', progressEl = null, galler
|
||||
parentGallery.removeChild(livePreview);
|
||||
}
|
||||
if (parentGallery) {
|
||||
parentGallery.style.minHeight = 'unset';
|
||||
parentGallery.style.maxHeight = 'unset';
|
||||
// parentGallery.style.minHeight = 'unset';
|
||||
// parentGallery.style.maxHeight = 'unset';
|
||||
parentGallery.style.overflow = 'unset';
|
||||
}
|
||||
} catch { /* ignore */ }
|
||||
|
||||
@@ -3,6 +3,7 @@ import { gradioApp, onAfterUiUpdate } from './script';
|
||||
import { log, debug, error } from './logger';
|
||||
import { timer } from './timers';
|
||||
import { authFetch } from './authWrap';
|
||||
import { updateModel } from './dynamicUI';
|
||||
import { getENActiveTab, markSelectedCards } from './extraNetworks';
|
||||
|
||||
window.opts = {};
|
||||
@@ -805,11 +806,12 @@ export async function reconnectUI() {
|
||||
let loadingStarted = 0;
|
||||
let loadingMonitor: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
const sd_model_callback = () => {
|
||||
const sd_model_callback = async () => {
|
||||
const loading = sd_model.querySelector('.eta-bar');
|
||||
if (!loading) {
|
||||
loadingStarted = 0;
|
||||
clearInterval(loadingMonitor);
|
||||
updateModel();
|
||||
} else if (loadingStarted === 0) {
|
||||
loadingStarted = Date.now();
|
||||
loadingMonitor = setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user