From 8f21e96f73e4149d2772582a843d4ed84a1fd029 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Wed, 11 Dec 2024 15:22:51 -0500 Subject: [PATCH] update bnb and increase ui timeouts Signed-off-by: Vladimir Mandic --- TODO.md | 1 + installer.py | 6 +++--- javascript/logger.js | 10 ++++++---- modules/model_quant.py | 4 ++-- modules/sd_samplers_common.py | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/TODO.md b/TODO.md index 9692b7635..76c672260 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,7 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - LoRA direct with caching - Previewer issues +- Redesign postprocessing ## Future Candidates diff --git a/installer.py b/installer.py index 93cd10413..b020418e1 100644 --- a/installer.py +++ b/installer.py @@ -682,7 +682,7 @@ def install_torch_addons(): if opts.get('nncf_compress_weights', False) and not args.use_openvino: install('nncf==2.7.0', 'nncf') if opts.get('optimum_quanto_weights', False): - install('optimum-quanto', 'optimum-quanto') + install('optimum-quanto==0.2.6', 'optimum-quanto') if triton_command is not None: install(triton_command, 'triton', quiet=True) @@ -999,8 +999,8 @@ def install_optional(): install('basicsr') install('gfpgan') install('clean-fid') - install('optimum-quanto', ignore=True) - install('bitsandbytes', ignore=True) + install('optimum-quanto=0.2.6', ignore=True) + install('bitsandbytes==0.45.0', ignore=True) install('pynvml', ignore=True) install('ultralytics==8.3.40', ignore=True) install('Cython', ignore=True) diff --git a/javascript/logger.js b/javascript/logger.js index 1677fa537..8fa812b86 100644 --- a/javascript/logger.js +++ b/javascript/logger.js @@ -1,3 +1,5 @@ +const timeout = 10000; + const log = async (...msg) => { const dt = new Date(); const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`; @@ -21,7 +23,7 @@ const error = async (...msg) => { // if (!txt.includes('asctime') && !txt.includes('xhr.')) xhrPost('/sdapi/v1/log', { error: txt }); // eslint-disable-line no-use-before-define }; -const xhrInternal = (xhrObj, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = 5000) => { +const xhrInternal = (xhrObj, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = timeout) => { const err = (msg) => { if (!ignore) { error(`${msg}: state=${xhrObj.readyState} status=${xhrObj.status} response=${xhrObj.responseText}`); @@ -30,7 +32,7 @@ const xhrInternal = (xhrObj, data, handler = undefined, errorHandler = undefined }; xhrObj.setRequestHeader('Content-Type', 'application/json'); - xhrObj.timeout = serverTimeout; + xhrObj.timeout = timeout; xhrObj.ontimeout = () => err('xhr.ontimeout'); xhrObj.onerror = () => err('xhr.onerror'); xhrObj.onabort = () => err('xhr.onabort'); @@ -52,14 +54,14 @@ const xhrInternal = (xhrObj, data, handler = undefined, errorHandler = undefined xhrObj.send(req); }; -const xhrGet = (url, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = 5000) => { +const xhrGet = (url, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = timeout) => { const xhr = new XMLHttpRequest(); const args = Object.keys(data).map((k) => `${encodeURIComponent(k)}=${encodeURIComponent(data[k])}`).join('&'); xhr.open('GET', `${url}?${args}`, true); xhrInternal(xhr, data, handler, errorHandler, ignore, serverTimeout); }; -function xhrPost(url, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = 5000) { +function xhrPost(url, data, handler = undefined, errorHandler = undefined, ignore = false, serverTimeout = timeout) { const xhr = new XMLHttpRequest(); xhr.open('POST', url, true); xhrInternal(xhr, data, handler, errorHandler, ignore, serverTimeout); diff --git a/modules/model_quant.py b/modules/model_quant.py index 03043b33a..5c0b40080 100644 --- a/modules/model_quant.py +++ b/modules/model_quant.py @@ -73,7 +73,7 @@ def load_bnb(msg='', silent=False): global bnb # pylint: disable=global-statement if bnb is not None: return bnb - install('bitsandbytes', quiet=True) + install('bitsandbytes==0.45.0', quiet=True) try: import bitsandbytes bnb = bitsandbytes @@ -96,7 +96,7 @@ def load_quanto(msg='', silent=False): global quanto # pylint: disable=global-statement if quanto is not None: return quanto - install('optimum-quanto', quiet=True) + install('optimum-quanto==0.2.6', quiet=True) try: from optimum import quanto as optimum_quanto # pylint: disable=no-name-in-module quanto = optimum_quanto diff --git a/modules/sd_samplers_common.py b/modules/sd_samplers_common.py index a96795a25..cd51043c7 100644 --- a/modules/sd_samplers_common.py +++ b/modules/sd_samplers_common.py @@ -51,6 +51,7 @@ def single_sample_to_image(sample, approximation=None): return Image.new(mode="RGB", size=(512, 512)) if len(sample.shape) == 4 and sample.shape[0]: # likely animatediff latent sample = sample.permute(1, 0, 2, 3)[0] + """ # TODO remove if shared.native: # [-x,x] to [-5,5] sample_max = torch.max(sample) @@ -59,7 +60,7 @@ def single_sample_to_image(sample, approximation=None): sample_min = torch.min(sample) if sample_min < -5: sample = sample * (5 / abs(sample_min)) - + """ if approximation == 2: # TAESD x_sample = sd_vae_taesd.decode(sample) x_sample = (1.0 + x_sample) / 2.0 # preview requires smaller range