mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
minor fixes from audit
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -34,9 +34,9 @@ This skill combines four audit surfaces. Run them in this order unless user scop
|
||||
- `modules/sd_detect.py`
|
||||
- `modules/sd_models.py`
|
||||
- `modules/modeldata.py`
|
||||
- `data/reference.json`
|
||||
- `data/reference-base.json`
|
||||
- `data/reference-cloud.json`
|
||||
- `data/reference-quant.json`
|
||||
- `data/reference-quantized.json`
|
||||
- `data/reference-distilled.json`
|
||||
- `data/reference-nunchaku.json`
|
||||
- `data/reference-community.json`
|
||||
@@ -83,9 +83,9 @@ Verify references for model families intended to appear in model references.
|
||||
Checks:
|
||||
|
||||
- Correct category file placement by type:
|
||||
- base -> `data/reference.json`
|
||||
- base -> `data/reference-base.json`
|
||||
- cloud -> `data/reference-cloud.json`
|
||||
- quant -> `data/reference-quant.json`
|
||||
- quant -> `data/reference-quantized.json`
|
||||
- distilled -> `data/reference-distilled.json`
|
||||
- nunchaku -> `data/reference-nunchaku.json`
|
||||
- community -> `data/reference-community.json`
|
||||
|
||||
@@ -230,6 +230,8 @@ def img2img(id_task: str, state: str, mode: int,
|
||||
elif mode == 4: # inpaint upload mask
|
||||
if init_img_inpaint is None:
|
||||
return [], '', '', 'Error: inpaint image not provided'
|
||||
if init_mask_inpaint is None:
|
||||
return [], '', '', 'Error: inpaint mask not provided'
|
||||
image = init_img_inpaint
|
||||
mask = init_mask_inpaint
|
||||
elif mode == 5: # process batch
|
||||
|
||||
@@ -445,7 +445,7 @@ def create_ui():
|
||||
# Load/Unload model buttons
|
||||
vlm_load_btn.click(fn=vqa.load_model, inputs=[vlm_model], outputs=[])
|
||||
vlm_unload_btn.click(fn=vqa.unload_model, inputs=[], outputs=[])
|
||||
analyze_load_btn.click(fn=vqa.load_model, inputs=[vlm_model], outputs=[])
|
||||
analyze_load_btn.click(fn=vqa.load_model, inputs=[analyze_model], outputs=[])
|
||||
analyze_unload_btn.click(fn=vqa.unload_model, inputs=[], outputs=[])
|
||||
|
||||
def tagger_load_wrapper(model_name):
|
||||
|
||||
@@ -36,7 +36,7 @@ class FLitePipelineOutput(BaseOutput):
|
||||
num_channels)`. PIL images or numpy array present the denoised images of the diffusion pipeline.
|
||||
"""
|
||||
|
||||
images: Union[List[Image.Image], np.ndarray]
|
||||
images: Union[List[Image.Image], np.ndarray, torch.Tensor]
|
||||
|
||||
|
||||
class FLitePipeline(DiffusionPipeline):
|
||||
@@ -147,6 +147,7 @@ class FLitePipeline(DiffusionPipeline):
|
||||
|
||||
def to(self, torch_device=None, torch_dtype=None, silence_dtype_warnings=False):
|
||||
"""Move pipeline components to specified device and dtype."""
|
||||
_ = silence_dtype_warnings
|
||||
if hasattr(self, "vae"):
|
||||
self.vae.to(device=torch_device, dtype=torch_dtype)
|
||||
if hasattr(self, "text_encoder"):
|
||||
@@ -169,6 +170,8 @@ class FLitePipeline(DiffusionPipeline):
|
||||
dtype: Optional[torch.dtype] = None,
|
||||
alpha: Optional[float] = None,
|
||||
apg_config: Optional[APGConfig] = None,
|
||||
output_type: str = "pil",
|
||||
return_dict: bool = True,
|
||||
**kwargs,
|
||||
):
|
||||
"""Generate images from text prompt."""
|
||||
@@ -293,10 +296,22 @@ class FLitePipeline(DiffusionPipeline):
|
||||
raise
|
||||
|
||||
# 8. Post-process images
|
||||
from modules.image import convert
|
||||
images = (decoded_images / 2 + 0.5).clamp(0, 1)
|
||||
pil_images = [convert.to_pil(img) for img in images]
|
||||
if output_type == "latent":
|
||||
output = latents
|
||||
elif output_type == "pt":
|
||||
output = images
|
||||
elif output_type == "np":
|
||||
output = images.permute(0, 2, 3, 1).to(device="cpu", dtype=torch.float32).numpy()
|
||||
elif output_type == "pil":
|
||||
from modules.image import convert
|
||||
output = [convert.to_pil(img) for img in images]
|
||||
else:
|
||||
raise ValueError(f"Unsupported output_type: {output_type}")
|
||||
|
||||
if not return_dict:
|
||||
return (output,)
|
||||
|
||||
return FLitePipelineOutput(
|
||||
images=pil_images,
|
||||
images=output,
|
||||
)
|
||||
|
||||
@@ -18,11 +18,10 @@ from transformers import CLIPTextModelWithProjection, CLIPTokenizer
|
||||
|
||||
from diffusers.image_processor import VaeImageProcessor
|
||||
from diffusers.models import VQModel
|
||||
|
||||
from .scheduler import Scheduler
|
||||
from diffusers.utils import replace_example_docstring
|
||||
from diffusers.pipelines.pipeline_utils import DiffusionPipeline, ImagePipelineOutput
|
||||
|
||||
from .scheduler import Scheduler
|
||||
from .transformer import Transformer2DModel
|
||||
|
||||
|
||||
@@ -34,7 +33,7 @@ EXAMPLE_DOC_STRING = """
|
||||
"""
|
||||
|
||||
|
||||
def _prepare_latent_image_ids(batch_size, height, width, device, dtype):
|
||||
def _prepare_latent_image_ids(batch_size, height, width, device, dtype): # pylint: disable=unused-argument
|
||||
latent_image_ids = torch.zeros(height // 2, width // 2, 3)
|
||||
latent_image_ids[..., 1] = latent_image_ids[..., 1] + torch.arange(height // 2)[:, None]
|
||||
latent_image_ids[..., 2] = latent_image_ids[..., 2] + torch.arange(width // 2)[None, :]
|
||||
|
||||
@@ -18,5 +18,7 @@ def load_instaflow(checkpoint_info, diffusers_load_config=None):
|
||||
|
||||
pipeline = diffusers.utils.get_class_from_dynamic_module('instaflow_one_step', module_file='pipeline.py')
|
||||
generic.set_pipeline('InstaFlow', pipeline)
|
||||
sd_model = pipeline.from_pretrained(checkpoint_info.path, cache_dir=shared.opts.diffusers_dir, **diffusers_load_config)
|
||||
load_config = {**diffusers_load_config, **load_args}
|
||||
sd_model = pipeline.from_pretrained(checkpoint_info.path, cache_dir=shared.opts.diffusers_dir, **load_config)
|
||||
devices.torch_gc(force=True, reason='load')
|
||||
return sd_model
|
||||
|
||||
@@ -17,6 +17,8 @@ def load_segmoe(checkpoint_info, diffusers_load_config=None):
|
||||
if repo_id is None or repo_id.lower() == 'none':
|
||||
return None
|
||||
|
||||
sd_model = SegMoEPipeline(checkpoint_info.path, cache_dir=shared.opts.diffusers_dir, **diffusers_load_config)
|
||||
load_config = {**diffusers_load_config, **load_args}
|
||||
sd_model = SegMoEPipeline(checkpoint_info.path, cache_dir=shared.opts.diffusers_dir, **load_config)
|
||||
sd_model = sd_model.pipe # segmoe pipe does its stuff in __init__ and __call__ is the original pipeline
|
||||
devices.torch_gc(force=True, reason='load')
|
||||
return sd_model
|
||||
|
||||
Reference in New Issue
Block a user