Merge pull request #2401 from vladmandic/master

update dev
This commit is contained in:
Vladimir Mandic
2023-10-24 17:38:13 -04:00
committed by GitHub
14 changed files with 32 additions and 33 deletions
+10 -7
View File
@@ -5,33 +5,31 @@
Service release addressing all zero-day issues reported so far...
**Fixes**
- fix freeu for backend original and add it to xyz grid
- fix **freeu** for backend original and add it to xyz grid
- fix loading diffuser models in huggingface format from non-standard location
- fix default styles looking in wrong location
- fix missing upscaler folder on initial startup
- fix handling of relative path for models
- fix simple live preview device mismatch
- fix batch img2img
- fix diffusers dpm++ 2m, dpm++ 1s, deis samplers
- fix diffusers samplers: dpm++ 2m, dpm++ 1s, deis
- fix new style filename template
- fix image name template using model name
- fix model path using relative path
- fix `torch-rocm` and `tensorflow-rocm` version detection, thanks @xangelix
- fix chainner upscalers color clipping
- fix **chainner** upscalers color clipping
- fix for base+refiner workflow in diffusers mode: number of steps, diffuser pipe mode
- fix for prompt encoder with refiner in diffusers mode
- fix prompts-from-file saving incorrect metadata
- fix before-hires step
- fix diffusers switch from invalid model
- directml and ipex updates
- **directml** and **ipex** updates
- force second requirements check on startup
- remove lyco, multiple_tqdm
- enhance extension compatibility for exensions directly importing codeformers
- enhance extension compatibility for exensions directly accessing processing params
- css fixes
- clearly mark external themes in ui
- new option: *settings -> images -> keep incomplete*
can be used to skip vae decode on aborted/skipped/interrupted image generations
- update `openvino`, thanks @disty0
- update `typing-extensions`
@@ -39,7 +37,12 @@ Service release addressing all zero-day issues reported so far...
- remove external clone of items in `/repositories`
- add **lora oft** support, thanks @antis0007 and @ai-casanova
- **upscalers compile** option, thanks @disty0
- **upscalers**
- **compile compile** option, thanks @disty0
- **chainner** add high quality models from [Helaman](https://openmodeldb.info/users/helaman)
- **chainner** switch to `torchvision.transforms` for all image decode operations
- new option: *settings -> images -> keep incomplete*
can be used to skip vae decode on aborted/skipped/interrupted image generations
**Themes**
+1 -1
View File
@@ -69,7 +69,7 @@ Additional models will be added as they become available and there is public int
- *Intel Arc* GPUs using **OneAPI** with *IPEX XPU* libraries on both *Windows and Linux*
- Any GPU compatible with *DirectX* on *Windows* using **DirectML** libraries.
This includes support for AMD GPUs that are not supported by native ROCm libraries
- Any GPU compatible with **OpenVINO** libraries on both *Windows and Linux*
- Any GPU or device compatible with **OpenVINO** libraries on both *Windows and Linux*
- *Apple M1/M2* on *OSX* using built-in support in Torch with **MPS** optimizations
## Install & Run
+1 -13
View File
@@ -77,7 +77,7 @@ function markIfModified(setting_name, value) {
tab_nav_indicator.classList.toggle('saved', saved.size > 0);
if (changed_items.size > 0) tab_nav_indicator.title += `click to reset ${changed_items.size} unapplied changes in this tab\n`;
if (saved.size > 0) tab_nav_indicator.title += `${saved.size} custom values\n${unsaved.size} default values}`;
elem.scrollIntoView({ behavior: 'smooth', block: 'center' });
elem.scrollIntoView({ behavior: 'smooth', block: 'center' }); // TODO why is scroll happening on every change if all pages are visible?
}
onAfterUiUpdate(async () => {
@@ -120,18 +120,6 @@ onAfterUiUpdate(async () => {
};
});
onOptionsChanged(() => {
const elem = gradioApp().getElementById('sd_checkpoint_hash');
const sd_checkpoint_hash = opts.sd_checkpoint_hash || '';
const shorthash = sd_checkpoint_hash.substring(0, 10);
if (elem && elem.textContent !== shorthash) {
elem.textContent = shorthash;
elem.title = sd_checkpoint_hash;
elem.href = `https://google.com/search?q=${sd_checkpoint_hash}`;
}
});
onOptionsChanged(() => {
const setting_elems = gradioApp().querySelectorAll('#settings [id^="setting_"]');
setting_elems.forEach((elem) => {
+1 -1
View File
@@ -20,7 +20,7 @@ def PNDMScheduler__get_prev_sample(self, sample: torch.FloatTensor, timestep, pr
beta_prod_t = 1 - alpha_prod_t
beta_prod_t_prev = 1 - alpha_prod_t_prev
if self.config.prediction_type == "v-prediction":
if self.config.prediction_type == "v_prediction":
model_output = (alpha_prod_t**0.5) * model_output + (beta_prod_t**0.5) * sample
elif self.config.prediction_type != "epsilon":
raise ValueError(
+3 -1
View File
@@ -183,7 +183,7 @@ def download_civit_model(model_url: str, model_name: str, model_path: str, model
return f'CivitAI download: name={model_name} url={model_url} path={model_path}'
def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config: Dict[str, str] = None, token = None, variant = None, revision = None, mirror = None):
def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config: Dict[str, str] = None, token = None, variant = None, revision = None, mirror = None, custom_pipeline = None):
if hub_id is None or len(hub_id) == 0:
return None
from diffusers import DiffusionPipeline
@@ -204,6 +204,8 @@ def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config
download_config["revision"] = revision
if mirror is not None and len(mirror) > 0:
download_config["mirror"] = mirror
if custom_pipeline is not None and len(custom_pipeline) > 0:
download_config["custom_pipeline"] = custom_pipeline
shared.log.debug(f"Diffusers downloading: {hub_id} {download_config}")
if token is not None and len(token) > 2:
shared.log.debug(f"Diffusers authentication: {token}")
+1 -1
View File
@@ -70,7 +70,7 @@ def progressapi(req: ProgressRequest):
if shared.state.job_count > 0:
progress += shared.state.job_no / shared.state.job_count
if shared.state.sampling_steps > 0 and shared.state.job_count > 0:
progress += 1 / shared.state.job_count * shared.state.sampling_step / shared.state.sampling_steps
progress += 1 / (shared.state.job_count / 2 if shared.state.processing_has_refined_job_count else 1) * shared.state.sampling_step / shared.state.sampling_steps
progress = min(progress, 1)
elapsed_since_start = time.time() - shared.state.time_start
predicted_duration = elapsed_since_start / progress if progress > 0 else None
+4 -1
View File
@@ -178,7 +178,7 @@ def list_models():
shared.opts.data['sd_model_checkpoint'] = checkpoint_info.title
elif shared.cmd_opts.ckpt != shared.default_sd_model_file and shared.cmd_opts.ckpt is not None:
shared.log.warning(f"Checkpoint not found: {shared.cmd_opts.ckpt}")
shared.log.info(f'Available models: {shared.opts.ckpt_dir} items={len(checkpoints_list)} time={time.time()-t0:.2f}s')
shared.log.info(f'Available models: path="{shared.opts.ckpt_dir}" items={len(checkpoints_list)} time={time.time()-t0:.2f}s')
checkpoints_list = dict(sorted(checkpoints_list.items(), key=lambda cp: cp[1].filename))
if len(checkpoints_list) == 0:
@@ -806,6 +806,9 @@ def load_diffuser(checkpoint_info=None, already_loaded_state_dict=None, timer=No
else:
diffusers_load_config['variant'] = shared.opts.diffusers_model_load_variant
if shared.opts.diffusers_pipeline == 'Custom Diffusers Pipeline':
diffusers_load_config['custom_pipeline'] = shared.opts.custom_diffusers_pipeline
if shared.opts.data.get('sd_model_checkpoint', '') == 'model.ckpt' or shared.opts.data.get('sd_model_checkpoint', '') == '':
shared.opts.data['sd_model_checkpoint'] = "runwayml/stable-diffusion-v1-5"
+1 -1
View File
@@ -98,7 +98,7 @@ def refresh_vae_list():
vae_dict[name] = os.path.dirname(filepath)
else:
vae_dict[name] = filepath
shared.log.info(f"Available VAEs: {vae_path} items={len(vae_dict)}")
shared.log.info(f'Available VAEs: path="{vae_path}" items={len(vae_dict)}')
return vae_dict
+2 -1
View File
@@ -337,6 +337,7 @@ options_templates.update(options_section(('diffusers', "Diffusers Settings"), {
"diffusers_attention_slicing": OptionInfo(False, "Enable attention slicing"),
"diffusers_model_load_variant": OptionInfo("default", "Diffusers model loading variant", gr.Radio, {"choices": ['default', 'fp32', 'fp16']}),
"diffusers_vae_load_variant": OptionInfo("default", "Diffusers VAE loading variant", gr.Radio, {"choices": ['default', 'fp32', 'fp16']}),
"custom_diffusers_pipeline": OptionInfo('hf-internal-testing/diffusers-dummy-pipeline', 'Custom Diffusers pipeline to use'),
"diffusers_lora_loader": OptionInfo("diffusers" if cmd_opts.use_openvino else "sequential apply", "Diffusers LoRA loading variant", gr.Radio, {"choices": ['diffusers', 'sequential apply', 'merge and apply']}),
"diffusers_force_zeros": OptionInfo(True, "Force zeros for prompts when empty"),
"diffusers_aesthetics_score": OptionInfo(False, "Require aesthetics score"),
@@ -473,7 +474,7 @@ options_templates.update(options_section(('sampler-params', "Sampler Settings"),
"schedulers_use_karras": OptionInfo(True, "Use Karras sigmas", gr.Checkbox, {"visible": False}),
"schedulers_use_thresholding": OptionInfo(False, "Use dynamic thresholding", gr.Checkbox, {"visible": False}),
"schedulers_use_loworder": OptionInfo(True, "Use simplified solvers in final steps", gr.Checkbox, {"visible": False}),
"schedulers_prediction_type": OptionInfo("default", "Override model prediction type", gr.Radio, {"choices": ['default', 'epsilon', 'sample', 'v-prediction'], "visible": False}),
"schedulers_prediction_type": OptionInfo("default", "Override model prediction type", gr.Radio, {"choices": ['default', 'epsilon', 'sample', 'v_prediction'], "visible": False}),
# managed from ui.py for backend diffusers
"schedulers_sep_diffusers": OptionInfo("<h2>Diffusers specific config</h2>", "", gr.HTML),
+1
View File
@@ -37,6 +37,7 @@ def get_pipelines():
'Stable Diffusion XL Img2Img': getattr(diffusers, 'StableDiffusionXLImg2ImgPipeline', None),
'Stable Diffusion XL Inpaint': getattr(diffusers, 'StableDiffusionXLInpaintPipeline', None),
'Stable Diffusion XL Instruct': getattr(diffusers, 'StableDiffusionXLInstructPix2PixPipeline', None),
'Custom Diffusers Pipeline': getattr(diffusers, 'DiffusionPipeline', None),
# 'Test': getattr(diffusers, 'TestPipeline', None),
# 'Kandinsky V1', 'Kandinsky V2', 'DeepFloyd IF', 'Shap-E', 'Kandinsky V1 Img2Img', 'Kandinsky V2 Img2Img', 'DeepFloyd IF Img2Img', 'Shap-E Img2Img',
}
+4 -3
View File
@@ -203,9 +203,9 @@ def create_ui():
def hf_select(evt: gr.SelectData, data):
return data[evt.index[0]][0]
def hf_download_model(hub_id: str, token, variant, revision, mirror):
def hf_download_model(hub_id: str, token, variant, revision, mirror, custom_pipeline):
from modules.modelloader import download_diffusers_model
download_diffusers_model(hub_id, cache_dir=opts.diffusers_dir, token=token, variant=variant, revision=revision, mirror=mirror)
download_diffusers_model(hub_id, cache_dir=opts.diffusers_dir, token=token, variant=variant, revision=revision, mirror=mirror, custom_pipeline=custom_pipeline)
from modules.sd_models import list_models # pylint: disable=W0621
list_models()
log.info(f'Diffuser model downloaded: model="{hub_id}"')
@@ -227,6 +227,7 @@ def create_ui():
with gr.Row():
hf_token = gr.Textbox('', label = 'Huggingface token', placeholder='optional access token for private or gated models')
hf_mirror = gr.Textbox('', label = 'Huggingface mirror', placeholder='optional mirror site for downloads')
hf_custom_pipeline = gr.Textbox('', label = 'Custom pipeline', placeholder='optional pipeline for downloads')
with gr.Column(scale=1):
gr.HTML('<br>')
hf_download_model_btn = gr.Button(value="Download model", variant='primary')
@@ -239,7 +240,7 @@ def create_ui():
hf_search_text.submit(fn=hf_search, inputs=[hf_search_text], outputs=[hf_results])
hf_search_btn.click(fn=hf_search, inputs=[hf_search_text], outputs=[hf_results])
hf_results.select(fn=hf_select, inputs=[hf_results], outputs=[hf_selected])
hf_download_model_btn.click(fn=hf_download_model, inputs=[hf_selected, hf_token, hf_variant, hf_revision, hf_mirror], outputs=[models_outcome])
hf_download_model_btn.click(fn=hf_download_model, inputs=[hf_selected, hf_token, hf_variant, hf_revision, hf_mirror, hf_custom_pipeline], outputs=[models_outcome])
with gr.Tab(label="CivitAI"):
data = []