From aec30cc063a9627775eb70e1e2deaf356a6040c1 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 4 Sep 2025 16:00:56 -0400 Subject: [PATCH] add --new flag Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 1 + installer.py | 14 +++++++++++--- modules/control/units/controlnet.py | 2 +- modules/face/insightface.py | 5 ++--- modules/sd_samplers.py | 2 +- requirements.txt | 1 - scripts/infiniteyou_ext.py | 5 ++--- scripts/pulid_ext.py | 5 ++--- 8 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7cf629c9..9c0f2073c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - move zluda flash attenion to *Triton Flash attention* option - remove samplers filtering - allow both flow-matching and discrete samplers for sdxl models + - cleanup command line parameters - **Fixes** - normalize path hanlding when deleting images - unified compile upscalers diff --git a/installer.py b/installer.py index 750733bef..ee585aa29 100644 --- a/installer.py +++ b/installer.py @@ -1244,6 +1244,15 @@ def install_gradio(): install(pkg, quiet=True) +def install_pydantic(): + if args.new: + install('pydantic==2.11.7', ignore=True, quiet=True) + reload('pydantic', '2.11.7') + else: + install('pydantic==1.10.21', ignore=True, quiet=True) + reload('pydantic', '1.10.21') + + def install_optional(): t_start = time.time() log.info('Installing optional requirements...') @@ -1259,10 +1268,8 @@ def install_optional(): install('Cython', ignore=True, quiet=True) install('git+https://github.com/deepinsight/insightface@554a05561cb71cfebb4e012dfea48807f845a0c2#subdirectory=python-package', 'insightface') # insightface==0.7.3 with patches install('albumentations==1.4.3', ignore=True, quiet=True) - install('pydantic==1.10.21', ignore=True, quiet=True) - reload('pydantic', '1.10.21') - install('gguf', ignore=True) install('av', ignore=True, quiet=True) + install('gguf', ignore=True) try: import gguf scripts_dir = os.path.join(os.path.dirname(gguf.__file__), '..', 'scripts') @@ -1297,6 +1304,7 @@ def install_requirements(): for line in lines: if not installed(line, quiet=True): _res = install(line) + install_pydantic() if args.profile: pr.disable() print_profile(pr, 'Requirements') diff --git a/modules/control/units/controlnet.py b/modules/control/units/controlnet.py index d8ff0fb7f..9ad4df844 100644 --- a/modules/control/units/controlnet.py +++ b/modules/control/units/controlnet.py @@ -327,7 +327,7 @@ class ControlNet(): errors.display(e, 'Control') if self.model is None: return - if not cmd_opts.lowvram: # lowvram will cause unet<->controlnet to ping-pong but saves more memory + if not cmd_opts.lowvram: # lowvram will cause unet<->controlnet to ping-pong but saves more memory self.model.offload_never = True if self.dtype is not None: self.model.to(self.dtype) diff --git a/modules/face/insightface.py b/modules/face/insightface.py index 78e6c34a7..b69648904 100644 --- a/modules/face/insightface.py +++ b/modules/face/insightface.py @@ -10,12 +10,11 @@ instightface_mp = None def get_app(mp_name, threshold=0.5, resolution=640): global insightface_app, instightface_mp # pylint: disable=global-statement - from installer import install, installed, reload + from installer import install, installed, install_pydantic if not installed('insightface', reload=False, quiet=True): install('git+https://github.com/deepinsight/insightface@554a05561cb71cfebb4e012dfea48807f845a0c2#subdirectory=python-package', 'insightface') # insightface==0.7.3 with patches install('albumentations==1.4.3', ignore=False, reinstall=True) - install('pydantic==1.10.21', ignore=False, reinstall=True, force=True) - reload('pydantic') + install_pydantic() if not installed('ip_adapter', reload=False, quiet=True): install('git+https://github.com/tencent-ailab/IP-Adapter.git', 'ip_adapter', ignore=False) diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py index 21a4627ed..c41eb91fb 100644 --- a/modules/sd_samplers.py +++ b/modules/sd_samplers.py @@ -79,7 +79,7 @@ def create_sampler(name, model): # sdxl allows both flow and discrete samplers is_flexible = (model is not None) and ('XL' in model.__class__.__name__) - + # restore default scheduler if name == 'Default' and hasattr(model, 'scheduler'): return restore_default(model) diff --git a/requirements.txt b/requirements.txt index 2cacf05d8..a188cc64d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -54,7 +54,6 @@ pytorch_lightning==2.5.4 urllib3==1.26.19 Pillow==10.4.0 timm==1.0.16 -pydantic==1.10.21 pyparsing==3.2.3 typing-extensions==4.14.1 sentencepiece==0.2.1 diff --git a/scripts/infiniteyou_ext.py b/scripts/infiniteyou_ext.py index 7172b03f7..e38185aa4 100644 --- a/scripts/infiniteyou_ext.py +++ b/scripts/infiniteyou_ext.py @@ -13,12 +13,11 @@ orig_pipeline, orig_prompt_attention = None, None def verify_insightface(): - from installer import installed, install, reload + from installer import installed, install, install_pydantic if not installed('insightface', reload=False, quiet=True): install('git+https://github.com/deepinsight/insightface@554a05561cb71cfebb4e012dfea48807f845a0c2#subdirectory=python-package', 'insightface') # insightface==0.7.3 with patches install('albumentations==1.4.3', ignore=False, reinstall=True) - install('pydantic==1.10.21', ignore=False, reinstall=True, force=True) - reload('pydantic') + install_pydantic() def load_infiniteyou(model: str): diff --git a/scripts/pulid_ext.py b/scripts/pulid_ext.py index 0c8b55f23..cd6c91005 100644 --- a/scripts/pulid_ext.py +++ b/scripts/pulid_ext.py @@ -28,12 +28,11 @@ class Script(scripts_manager.Script): return True def dependencies(self): - from installer import install, installed, reload + from installer import install, installed, install_pydantic if not installed('insightface==0.7.3', reload=False, quiet=True): install('git+https://github.com/deepinsight/insightface@554a05561cb71cfebb4e012dfea48807f845a0c2#subdirectory=python-package', 'insightface') # insightface==0.7.3 with patches install('albumentations==1.4.3', ignore=False, reinstall=True) - install('pydantic==1.10.21', ignore=False, reinstall=True, force=True) - reload('pydantic') + install_pydantic() def register(self): # register xyz grid elements global registered # pylint: disable=global-statement