mirror of
https://github.com/vladmandic/automatic
synced 2026-09-13 18:18:44 +02:00
upgrade diffusers
This commit is contained in:
@@ -18,6 +18,8 @@ Mostly a service release, but with some changes in behavior, especially in HiRes
|
||||
- all combinations of: decode full/quick + upscale none/latent/non-latent + hires on/off + refiner on/off
|
||||
should be supported, but given the number of combinations, issues are possible
|
||||
- all operations are captured in image medata
|
||||
- diffusers:
|
||||
- allow loading of sd/sdxl models from safetensors without online connectivity
|
||||
- minor re-layout of the main ui
|
||||
- update **ui hints**
|
||||
- updated **models -> civitai**
|
||||
|
||||
@@ -153,13 +153,18 @@ function setupExtraNetworksForTab(tabname) {
|
||||
tabs.appendChild(div);
|
||||
div.appendChild(search);
|
||||
div.appendChild(description);
|
||||
let searchTimer = null;
|
||||
search.addEventListener('input', (evt) => {
|
||||
const searchTerm = search.value.toLowerCase();
|
||||
gradioApp().querySelectorAll(`#${tabname}_extra_tabs div.card`).forEach((elem) => {
|
||||
let text = `${elem.querySelector('.name').textContent.toLowerCase()} ${elem.querySelector('.search_term').textContent.toLowerCase()}`;
|
||||
text = text.replace('models--', 'Diffusers');
|
||||
elem.style.display = text.indexOf(searchTerm) === -1 ? 'none' : '';
|
||||
});
|
||||
if (searchTimer) clearTimeout(searchTimer);
|
||||
searchTimer = setTimeout(() => {
|
||||
const searchTerm = search.value.toLowerCase();
|
||||
gradioApp().querySelectorAll(`#${tabname}_extra_tabs div.card`).forEach((elem) => {
|
||||
let text = `${elem.querySelector('.name').textContent.toLowerCase()} ${elem.querySelector('.search_term').textContent.toLowerCase()}`;
|
||||
text = text.replace('models--', 'Diffusers');
|
||||
elem.style.display = text.indexOf(searchTerm) === -1 ? 'none' : '';
|
||||
});
|
||||
searchTimer = null;
|
||||
}, 100);
|
||||
});
|
||||
|
||||
let hoverTimer = null;
|
||||
|
||||
@@ -230,7 +230,7 @@ table.settings-value-table td { padding: 0.4em; border: 1px solid #ccc; max-widt
|
||||
.extra-networks .description { flex: 3; }
|
||||
.extra-networks .tab-nav > button { margin-right: 0; height: 24px; padding: 2px 4px 2px 4px; }
|
||||
.extra-networks-tab { padding: 0 !important; }
|
||||
.extra-network-subdirs { background: var(--input-background-fill); overflow-x: hidden; overflow-y: auto; min-width: 20%; padding-top: 0.5em; }
|
||||
.extra-network-subdirs { background: var(--input-background-fill); overflow-x: hidden; overflow-y: auto; min-width: max(20%, 120px); padding-top: 0.5em; }
|
||||
.extra-networks-page { display: flex }
|
||||
.extra-networks .custom-button { width: 120px; width: 100%; background: none; justify-content: left; text-align: left; padding: 2px 8px 2px 16px; text-indent: -8px; box-shadow: none; line-break: auto; }
|
||||
.extra-networks .custom-button:hover { background: var(--button-primary-background-fill) }
|
||||
|
||||
+2
-3
@@ -160,7 +160,7 @@ def test_bf16():
|
||||
|
||||
|
||||
def set_cuda_params():
|
||||
shared.log.debug('Verifying Torch settings')
|
||||
# shared.log.debug('Verifying Torch settings')
|
||||
if cuda_ok:
|
||||
try:
|
||||
torch.backends.cuda.matmul.allow_tf32 = True
|
||||
@@ -212,8 +212,7 @@ def set_cuda_params():
|
||||
else:
|
||||
inference_context = torch.no_grad
|
||||
shared.log.debug(f'Desired Torch parameters: dtype={shared.opts.cuda_dtype} no-half={shared.opts.no_half} no-half-vae={shared.opts.no_half_vae} upscast={shared.opts.upcast_sampling}')
|
||||
shared.log.info(f'Setting Torch parameters: dtype={dtype} vae={dtype_vae} unet={dtype_unet} context={inference_context.__name__} fp16={fp16_ok} bf16={bf16_ok}')
|
||||
shared.log.debug(f'Torch default device: {torch.device(get_optimal_device_name())}')
|
||||
shared.log.info(f'Setting Torch parameters: device={torch.device(get_optimal_device_name())} dtype={dtype} vae={dtype_vae} unet={dtype_unet} context={inference_context.__name__} fp16={fp16_ok} bf16={bf16_ok}')
|
||||
|
||||
|
||||
args = cmd_args.parser.parse_args()
|
||||
|
||||
@@ -68,7 +68,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
time.sleep(0.1)
|
||||
|
||||
def full_vae_decode(latents, model):
|
||||
shared.log.debug(f'VAE decode: name={sd_vae.loaded_vae_file if sd_vae.loaded_vae_file is not None else "baked"} dtype={model.vae.dtype} upcast={model.vae.config.get("force_upcast", None)} images={latents.shape[0]} latents={latents.shape}')
|
||||
t0 = time.time()
|
||||
if shared.opts.diffusers_move_unet and not model.has_accelerate:
|
||||
shared.log.debug('Moving to CPU: model=UNet')
|
||||
unet_device = model.unet.device
|
||||
@@ -80,6 +80,8 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
decoded = model.vae.decode(latents / model.vae.config.scaling_factor, return_dict=False)[0]
|
||||
if shared.opts.diffusers_move_unet and not model.has_accelerate:
|
||||
model.unet.to(unet_device)
|
||||
t1 = time.time()
|
||||
shared.log.debug(f'VAE decode: name={sd_vae.loaded_vae_file if sd_vae.loaded_vae_file is not None else "baked"} dtype={model.vae.dtype} upcast={model.vae.config.get("force_upcast", None)} images={latents.shape[0]} latents={latents.shape} time={round(t1-t0, 3)}s')
|
||||
return decoded
|
||||
|
||||
def full_vae_encode(image, model):
|
||||
@@ -168,7 +170,7 @@ def process_diffusers(p: StableDiffusionProcessing, seeds, prompts, negative_pro
|
||||
except Exception:
|
||||
is_refiner = False
|
||||
if hasattr(model, "set_progress_bar_config"):
|
||||
model.set_progress_bar_config(bar_format='Progress {rate_fmt}{postfix} {bar} {percentage:3.0f}% {n_fmt}/{total_fmt} {elapsed} {remaining} '+desc, ncols=80, colour='#327fba')
|
||||
model.set_progress_bar_config(bar_format='Progress {rate_fmt}{postfix} {bar} {percentage:3.0f}% {n_fmt}/{total_fmt} {elapsed} {remaining} ' + '\x1b[38;5;71m' + desc, ncols=80, colour='#327fba')
|
||||
args = {}
|
||||
signature = inspect.signature(type(model).__call__)
|
||||
possible = signature.parameters.keys()
|
||||
|
||||
@@ -719,7 +719,7 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No
|
||||
if vae is not None:
|
||||
diffusers_load_config["vae"] = vae
|
||||
|
||||
shared.log.info(f'Loading diffuser {op}: {checkpoint_info.filename}')
|
||||
# shared.log.info(f'Loading diffuser {op}: {checkpoint_info.filename}')
|
||||
if not os.path.isfile(checkpoint_info.path):
|
||||
try:
|
||||
# shared.log.debug(f'Diffusers load {op} config: {diffusers_load_config}')
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ requests==2.31.0
|
||||
tqdm==4.65.0
|
||||
accelerate==0.20.3
|
||||
opencv-python-headless==4.7.0.72
|
||||
diffusers==0.20.2
|
||||
diffusers==0.21.1
|
||||
einops==0.4.1
|
||||
gradio==3.43.2
|
||||
huggingface_hub==0.16.4
|
||||
|
||||
Reference in New Issue
Block a user