diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fc24a459..afedf367b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -128,6 +128,11 @@ As of this release, default backend is set to **diffusers** as its more feature - [FreeInit](https://tianxingwu.github.io/pages/FreeInit/) for **AnimateDiff** - greatly improves temporal consistency of generated outputs - all options are available in animateddiff script +- [SalesForce BlipDiffusion](https://huggingface.co/docs/diffusers/api/pipelines/blip_diffusion) + - model can be used to replace anything in an image + - requires input image + - last word in prompt and negative prompt will be used as source and target subjects + - sampler must be set to default before loading the model - **Improvements** - **ui** - check version and **update** SD.Next via UI diff --git a/modules/processing_diffusers.py b/modules/processing_diffusers.py index 1a323131f..99233c74a 100644 --- a/modules/processing_diffusers.py +++ b/modules/processing_diffusers.py @@ -189,6 +189,16 @@ def process_diffusers(p: processing.StableDiffusionProcessing): 'width': p.width if hasattr(p, 'width') else None, 'height': p.height if hasattr(p, 'height') else None, } + if model.__class__.__name__ == 'BlipDiffusionPipeline': + if len(getattr(p, 'init_images', [])) == 0: + shared.log.error('BLiP diffusion requires init image') + return task_args + task_args = { + 'reference_image': p.init_images[0], + 'source_subject_category': getattr(p, 'negative_prompt', '').split()[-1], + 'target_subject_category': getattr(p, 'prompt', '').split()[-1], + 'output_type': 'pil', + } debug(f'Diffusers task specific args: {task_args}') return task_args diff --git a/modules/textual_inversion/textual_inversion.py b/modules/textual_inversion/textual_inversion.py index 9a60460c0..cc264ee17 100644 --- a/modules/textual_inversion/textual_inversion.py +++ b/modules/textual_inversion/textual_inversion.py @@ -269,7 +269,10 @@ class EmbeddingDatabase: if loaded_embeddings.get(embedding.name, None) == embedding: continue self.skipped_embeddings[embedding.name] = embedding - debug(f"TI Loading: Text Encoder total embeddings={shared.sd_model.text_encoder.get_input_embeddings().weight.data.shape[0]}") + try: + debug(f"TI Loading: Text Encoder total embeddings={shared.sd_model.text_encoder.get_input_embeddings().weight.data.shape[0]}") + except Exception: + pass if model_type == 'SDXL': debug(f"TI Loading: Text Encoder 2 total embeddings={shared.sd_model.text_encoder_2.get_input_embeddings().weight.data.shape[0]}") return len(self.word_embeddings) - _loaded_pre