diff --git a/cli/full-test.sh b/cli/full-test.sh new file mode 100755 index 000000000..e410528ad --- /dev/null +++ b/cli/full-test.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +source venv/bin/activate +echo image-exif +python cli/api-info.py --input html/logo-bg-0.jpg +echo txt2img +python cli/api-txt2img.py --detailer --prompt "girl on a mountain" --seed 42 --sampler DEIS --width 1280 --height 800 --steps 10 +echo img2img +python cli/api-img2img.py --init html/logo-bg-0.jpg --steps 10 +echo inpaint +python cli/api-img2img.py --init html/logo-bg-0.jpg --mask html/logo-dark.png --steps 10 +echo upscale +python cli/api-upscale.py --input html/logo-bg-0.jpg --upscaler "ESRGAN 4x Valar" --scale 4 +echo vqa +python cli/api-vqa.py --input html/logo-bg-0.jpg +echo detailer +python cli/api-detect.py --image html/invoked.jpg +echo faceid +python cli/api-faceid.py --face html/simple-dark.jpg +echo control-txt2img +python cli/api-control.py --prompt "cute robot" +echo control-img2img +python cli/api-control.py --prompt "cute robot" --input html/logo-bg-0.jpg +echo control-ipsadapter +python cli/api-control.py --prompt "cute robot" --ipadapter "Base SDXL:html/logo-bg-0.jpg:0.8" +echo control-preprocess +python cli/api-preprocess.py --input html/logo-bg-0.jpg --model "Zoe Depth" +echo control-controlnet +python cli/api-control.py --prompt "cute robot" --input html/logo-bg-0.jpg --type controlnet --control "Zoe Depth:Xinsir Union XL:0.5" diff --git a/modules/api/control.py b/modules/api/control.py index ffb000053..29c5a77f1 100644 --- a/modules/api/control.py +++ b/modules/api/control.py @@ -104,7 +104,7 @@ class APIControl(): args['ip_adapter_scales'].append(ipadapter.scale) args['ip_adapter_starts'].append(ipadapter.start) args['ip_adapter_ends'].append(ipadapter.end) - args['ip_adapter_crops'].append(ipadapter.end) + args['ip_adapter_crops'].append(ipadapter.crop) args['ip_adapter_images'].append([helpers.decode_base64_to_image(x) for x in ipadapter.images]) if ipadapter.masks: args['ip_adapter_masks'].append([helpers.decode_base64_to_image(x) for x in ipadapter.masks]) diff --git a/modules/control/run.py b/modules/control/run.py index c141c8443..5d6343c98 100644 --- a/modules/control/run.py +++ b/modules/control/run.py @@ -66,7 +66,7 @@ def control_run(state: str = '', resize_mode_before: int = 0, resize_name_before: str = 'None', resize_context_before: str = 'None', width_before: int = 512, height_before: int = 512, scale_by_before: float = 1.0, selected_scale_tab_before: int = 0, resize_mode_after: int = 0, resize_name_after: str = 'None', resize_context_after: str = 'None', width_after: int = 0, height_after: int = 0, scale_by_after: float = 1.0, selected_scale_tab_after: int = 0, resize_mode_mask: int = 0, resize_name_mask: str = 'None', resize_context_mask: str = 'None', width_mask: int = 0, height_mask: int = 0, scale_by_mask: float = 1.0, selected_scale_tab_mask: int = 0, - denoising_strength: float = 0.0, batch_count: int = 1, batch_size: int = 1, + denoising_strength: float = 0.3, batch_count: int = 1, batch_size: int = 1, enable_hr: bool = False, hr_sampler_index: int = None, hr_denoising_strength: float = 0.0, hr_resize_mode: int = 0, hr_resize_context: str = 'None', hr_upscaler: str = None, hr_force: bool = False, hr_second_pass_steps: int = 20, hr_scale: float = 1.0, hr_resize_x: int = 0, hr_resize_y: int = 0, refiner_steps: int = 5, refiner_start: float = 0.0, refiner_prompt: str = '', refiner_negative: str = '', video_skip_frames: int = 0, video_type: str = 'None', video_duration: float = 2.0, video_loop: bool = False, video_pad: int = 0, video_interpolate: int = 0, diff --git a/modules/processing_class.py b/modules/processing_class.py index c61fd7e8e..b0b9e1f1b 100644 --- a/modules/processing_class.py +++ b/modules/processing_class.py @@ -72,7 +72,7 @@ class StableDiffusionProcessing: resize_mode: int = 0, resize_name: str = 'None', resize_context: str = 'None', - denoising_strength: float = 0.0, + denoising_strength: float = 0.3, image_cfg_scale: float = None, initial_noise_multiplier: float = None, # pylint: disable=unused-argument # a1111 compatibility scale_by: float = 1, @@ -161,18 +161,6 @@ class StableDiffusionProcessing: self.do_not_reload_embeddings = do_not_reload_embeddings self.detailer = detailer self.restore_faces = restore_faces - self.hdr_mode = hdr_mode - self.hdr_brightness = hdr_brightness - self.hdr_color = hdr_color - self.hdr_sharpen = hdr_sharpen - self.hdr_clamp = hdr_clamp - self.hdr_boundary = hdr_boundary - self.hdr_threshold = hdr_threshold - self.hdr_maximize = hdr_maximize - self.hdr_max_center = hdr_max_center - self.hdr_max_boundry = hdr_max_boundry - self.hdr_color_picker = hdr_color_picker - self.hdr_tint_ratio = hdr_tint_ratio self.init_images = init_images self.resize_mode = resize_mode self.resize_name = resize_name @@ -242,14 +230,6 @@ class StableDiffusionProcessing: self.all_seeds = None self.all_subseeds = None - # ip adapter - self.ip_adapter_names = [] - self.ip_adapter_scales = [0.0] - self.ip_adapter_images = [] - self.ip_adapter_starts = [0.0] - self.ip_adapter_ends = [1.0] - self.ip_adapter_crops = [] - # a1111 compatibility items shared.opts.data['clip_skip'] = int(self.clip_skip) # for compatibility with a1111 sd_hijack_clip self.seed_enable_extras: bool = True, @@ -286,18 +266,7 @@ class StableDiffusionProcessing: self.s_tmin = shared.opts.s_tmin self.s_tmax = float('inf') # not representable as a standard ui option self.task_args = {} - # a1111 compatibility items - self.batch_index = 0 - self.refiner_switch_at = 0 - self.hr_prompt = '' - self.all_hr_prompts = [] - self.hr_negative_prompt = '' - self.all_hr_negative_prompts = [] - self.comments = {} - self.is_api = False - self.scripts_value: scripts.ScriptRunner = field(default=None, init=False) - self.script_args_value: list = field(default=None, init=False) - self.scripts_setup_complete: bool = field(default=False, init=False) + # ip adapter self.ip_adapter_names = [] self.ip_adapter_scales = [0.0] @@ -305,6 +274,7 @@ class StableDiffusionProcessing: self.ip_adapter_starts = [0.0] self.ip_adapter_ends = [1.0] self.ip_adapter_crops = [] + # hdr self.hdr_mode=hdr_mode self.hdr_brightness=hdr_brightness @@ -318,8 +288,10 @@ class StableDiffusionProcessing: self.hdr_max_boundry=hdr_max_boundry self.hdr_color_picker=hdr_color_picker self.hdr_tint_ratio=hdr_tint_ratio + # globals self.embedder = None + self.override = None self.scheduled_prompt: bool = False self.prompt_embeds = [] self.positive_pooleds = [] diff --git a/modules/shared.py b/modules/shared.py index c32aa80c0..7b273b0f9 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -251,6 +251,7 @@ class OptionInfo: self.comment_before = comment_before # HTML text that will be added after label in UI self.comment_after = comment_after # HTML text that will be added before label in UI self.submit = submit + self.exclude = ['sd_model_checkpoint', 'sd_model_refiner', 'sd_vae', 'sd_unet', 'sd_text_encoder', 'sd_model_dict'] def needs_reload_ui(self): return self @@ -276,6 +277,8 @@ class OptionInfo: return self def validate(self, opt, value): + if opt in self.exclude: + return True args = self.component_args if self.component_args is not None else {} if callable(args): try: diff --git a/package.json b/package.json index bf5a366ea..b30d3f87d 100644 --- a/package.json +++ b/package.json @@ -16,11 +16,13 @@ "url": "git+https://github.com/vladmandic/automatic.git" }, "scripts": { + "venv": "source venv/bin/activate", "start": "python launch.py --debug --experimental", "ruff": "ruff check", "eslint": "eslint javascript/ extensions-builtin/sdnext-modernui/javascript/", "pylint": "pylint *.py modules/ extensions-builtin/", - "lint": "npm run eslint; npm run ruff; npm run pylint" + "lint": "npm run eslint; npm run ruff; npm run pylint", + "test": "cli/test.sh" }, "devDependencies": { "esbuild": "^0.18.15"