mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
control auto-install process depenencies
This commit is contained in:
@@ -83,6 +83,7 @@ As of this release, default backend is set to **diffusers** as its more feature
|
||||
- support controlnets with non-default yaml config files
|
||||
- implement resize modes for override images
|
||||
- allow any selection of units
|
||||
- dynamically install depenencies required by specific processors
|
||||
- fix input image size
|
||||
- fix video color mode
|
||||
- fix correct image mode
|
||||
|
||||
Submodule extensions-builtin/stable-diffusion-webui-images-browser updated: 8dc4665c4f...3d2d0f4c7b
@@ -44,18 +44,22 @@
|
||||
},
|
||||
"StabilityAI SD-XL 1.0 Base": {
|
||||
"path": "stabilityai/stable-diffusion-xl-base-1.0",
|
||||
"variant": "fp16",
|
||||
"desc": "Stable Diffusion XL (SDXL) is the latest AI image generation model that is tailored towards more photorealistic outputs with more detailed imagery and composition compared to previous SD models, including SD 2.1. It can make realistic faces, legible text within the images, and better image composition, all while using shorter and simpler prompts at a greatly increased base resolution of 1024x1024. Just like its predecessors, SDXL has the ability to generate image variations using image-to-image prompting, inpainting (reimagining of the selected parts of an image), and outpainting (creating new parts that lie outside the image borders).",
|
||||
"preview": "stabilityai--stable-diffusion-xl-base-1.0.jpg"
|
||||
},
|
||||
"StabilityAI SD 2.1 Turbo": {
|
||||
"path": "stabilityai/sd-turbo",
|
||||
"alt": "sd_turbo.safetensors@https://huggingface.co/stabilityai/sd-turbo/resolve/main/sd_turbo.safetensors?download=true",
|
||||
"variant": "fp16",
|
||||
"desc": "SD-Turbo is a distilled version of Stable Diffusion 2.1, trained for real-time synthesis. SD-Turbo is based on a novel training method called Adversarial Diffusion Distillation (ADD) (see the technical report), which allows sampling large-scale foundational image diffusion models in 1 to 4 steps at high image quality. This approach uses score distillation to leverage large-scale off-the-shelf image diffusion models as a teacher signal and combines this with an adversarial loss to ensure high image fidelity even in the low-step regime of one or two sampling steps.",
|
||||
"preview": "stabilityai--sd-turbo.jpg",
|
||||
"original": true
|
||||
},
|
||||
"StabilityAI SD-XL Turbo": {
|
||||
"path": "stabilityai/sdxl-turbo",
|
||||
"alt": "sdxl_turbo.safetensors@https://huggingface.co/stabilityai/sdxl-turbo/resolve/main/sdxl_turbo.safetensors?download=true",
|
||||
"variant": "fp16",
|
||||
"desc": "SDXL-Turbo is a distilled version of SDXL 1.0, trained for real-time synthesis. SDXL-Turbo is based on a novel training method called Adversarial Diffusion Distillation (ADD) (see the technical report), which allows sampling large-scale foundational image diffusion models in 1 to 4 steps at high image quality. This approach uses score distillation to leverage large-scale off-the-shelf image diffusion models as a teacher signal and combines this with an adversarial loss to ensure high image fidelity even in the low-step regime of one or two sampling steps.",
|
||||
"preview": "stabilityai--sdxl-turbo.jpg"
|
||||
},
|
||||
|
||||
@@ -6,13 +6,28 @@
|
||||
|
||||
import os
|
||||
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
from modules.control.util import HWC3, resize_image
|
||||
from .draw import draw_bodypose, draw_handpose, draw_facepose
|
||||
checked_ok = False
|
||||
|
||||
|
||||
def check_dependencies():
|
||||
global checked_ok # pylint: disable=global-statement
|
||||
from installer import installed, install, log
|
||||
packages = [('openmim', 'openmim'), ('mmengine', 'mmengine'), ('mmcv', 'mmcv'), ('mmpose', 'mmpose'), ('mmdet', 'mmdet')]
|
||||
for pkg in packages:
|
||||
if not installed(pkg[1], reload=True, quiet=True):
|
||||
install(pkg[0], pkg[1], ignore=False)
|
||||
try:
|
||||
import mmcv # pylint: disable=unused-import
|
||||
checked_ok = True
|
||||
return True
|
||||
except Exception as e:
|
||||
log.error(f'DWPose: {e}')
|
||||
return False
|
||||
|
||||
|
||||
def draw_pose(pose, H, W):
|
||||
@@ -31,6 +46,9 @@ def draw_pose(pose, H, W):
|
||||
|
||||
class DWposeDetector:
|
||||
def __init__(self, det_config=None, det_ckpt=None, pose_config=None, pose_ckpt=None, device="cpu"):
|
||||
if not checked_ok:
|
||||
if not check_dependencies():
|
||||
return
|
||||
from .wholebody import Wholebody
|
||||
self.pose_estimation = Wholebody(det_config, det_ckpt, pose_config, pose_ckpt, device)
|
||||
|
||||
|
||||
@@ -5,6 +5,24 @@ from PIL import Image
|
||||
from modules.control.util import HWC3, resize_image
|
||||
|
||||
|
||||
checked_ok = False
|
||||
|
||||
def check_dependencies():
|
||||
global checked_ok # pylint: disable=global-statement
|
||||
from installer import installed, install, log
|
||||
packages = [('mediapipe', 'mediapipe')]
|
||||
for pkg in packages:
|
||||
if not installed(pkg[1], reload=True, quiet=True):
|
||||
install(pkg[0], pkg[1], ignore=False)
|
||||
try:
|
||||
import mediapipe as mp # pylint: disable=unused-import
|
||||
checked_ok = True
|
||||
return True
|
||||
except Exception as e:
|
||||
log.error(f'MediaPipe: {e}')
|
||||
return False
|
||||
|
||||
|
||||
class MediapipeFaceDetector:
|
||||
def __call__(self,
|
||||
input_image: Union[np.ndarray, Image.Image] = None,
|
||||
@@ -14,6 +32,9 @@ class MediapipeFaceDetector:
|
||||
detect_resolution: int = 512,
|
||||
image_resolution: int = 512,
|
||||
**kwargs):
|
||||
if not checked_ok:
|
||||
if not check_dependencies():
|
||||
return
|
||||
from .mediapipe_face_util import generate_annotation
|
||||
if input_image is None:
|
||||
raise ValueError("input_image must be defined.")
|
||||
|
||||
+14
-1
@@ -296,7 +296,20 @@ def load_reference(name: str):
|
||||
shared.log.debug(f'Reference model: {found[0]}')
|
||||
return True
|
||||
shared.log.debug(f'Reference download: {name}')
|
||||
model_dir = download_diffusers_model(name, shared.opts.diffusers_dir)
|
||||
reference_models = shared.readfile(os.path.join('html', 'reference.json'), silent=False)
|
||||
model_opts = {}
|
||||
for v in reference_models.values():
|
||||
if v.get('path', '') == name:
|
||||
model_opts = v
|
||||
break
|
||||
model_dir = download_diffusers_model(
|
||||
hub_id=name,
|
||||
cache_dir=shared.opts.diffusers_dir,
|
||||
variant=model_opts.get('variant', None),
|
||||
revision=model_opts.get('revision', None),
|
||||
mirror=model_opts.get('mirror', None),
|
||||
custom_pipeline=model_opts.get('custom_pipeline', None)
|
||||
)
|
||||
if model_dir is None:
|
||||
shared.log.debug(f'Reference download failed: {name}')
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user