diff --git a/dreambooth/train_dreambooth.py b/dreambooth/train_dreambooth.py index 193d64a..d71856a 100644 --- a/dreambooth/train_dreambooth.py +++ b/dreambooth/train_dreambooth.py @@ -37,7 +37,6 @@ from diffusers.utils.torch_utils import randn_tensor from torch.cuda.profiler import profile from torch.nn.utils.parametrizations import _SpectralNorm from torch.nn.utils.parametrize import register_parametrization, remove_parametrizations -from torch.utils.data import Dataset from transformers import AutoTokenizer from extensions.sd_dreambooth_extension.dreambooth import shared @@ -52,7 +51,8 @@ from extensions.sd_dreambooth_extension.dreambooth.diff_lora_to_sd_lora import c from extensions.sd_dreambooth_extension.dreambooth.diff_to_sd import compile_checkpoint, copy_diffusion_model from extensions.sd_dreambooth_extension.dreambooth.diff_to_sdxl import compile_checkpoint as compile_checkpoint_xl from extensions.sd_dreambooth_extension.dreambooth.memory import find_executable_batch_size -from extensions.sd_dreambooth_extension.dreambooth.optimization import UniversalScheduler, get_optimizer, get_noise_scheduler +from extensions.sd_dreambooth_extension.dreambooth.optimization import UniversalScheduler, get_optimizer, \ + get_noise_scheduler from extensions.sd_dreambooth_extension.dreambooth.shared import status from extensions.sd_dreambooth_extension.dreambooth.utils.gen_utils import generate_classifiers, generate_dataset from extensions.sd_dreambooth_extension.dreambooth.utils.image_utils import db_save_image, get_scheduler_class @@ -65,7 +65,7 @@ from extensions.sd_dreambooth_extension.dreambooth.utils.model_utils import ( ) from extensions.sd_dreambooth_extension.dreambooth.utils.text_utils import encode_hidden_state, save_token_counts from extensions.sd_dreambooth_extension.dreambooth.utils.utils import (cleanup, printm, verify_locon_installed, - patch_accelerator_for_fp16_training) + patch_accelerator_for_fp16_training) from extensions.sd_dreambooth_extension.dreambooth.webhook import send_training_update from extensions.sd_dreambooth_extension.dreambooth.xattention import optim_to from helpers.ema_model import EMAModel @@ -250,20 +250,6 @@ def main(class_gen_method: str = "Native Diffusers", user: str = None) -> TrainR status_handler = None logging_dir = Path(args.model_dir, "logging") global export_diffusers, user_model_dir - try: - from core.handlers.status import StatusHandler - from core.handlers.config import ConfigHandler - from core.handlers.models import ModelHandler - - mh = ModelHandler(user_name=user) - status_handler = StatusHandler(user_name=user, target="dreamProgress") - export_diffusers = True - user_model_dir = mh.user_path - logger.debug(f"Export diffusers: {export_diffusers}, diffusers dir: {user_model_dir}") - shared.status_handler = status_handler - logger.debug(f"Loaded config: {args.__dict__}") - except: - pass log_parser = LogParser() def update_status(data: dict): diff --git a/postinstall.py b/postinstall.py index 53220d9..11f418d 100644 --- a/postinstall.py +++ b/postinstall.py @@ -203,14 +203,7 @@ def install_requirements(): print("pip install numpy scipy") pass - if has_diffusers and has_tqdm and Version(transformers_version) < Version("4.48.3"): - print() - print("Does your project take forever to startup?") - print("Repetitive dependency installation may be the reason.") - print("Automatic1111's base project sets strict requirements on outdated dependencies.") - print( - "If an extension is using a newer version, the dependency is uninstalled and reinstalled twice every startup.") - print() + # Removed outdated transformers version warning that doesn't match requirements.txt def check_xformers(): @@ -220,7 +213,7 @@ def check_xformers(): print("Checking xformers...") try: xformers_version = importlib_metadata.version("xformers") - xformers_outdated = Version(xformers_version) < Version("0.0.21") + xformers_outdated = Version(xformers_version) < Version("0.0.27") # Parse arguments, see if --xformers is passed from modules import shared cmd_opts = shared.cmd_opts @@ -243,7 +236,7 @@ def check_bitsandbytes(): bitsandbytes_version = None print("Checking bitsandbytes (ALL!)") - if bitsandbytes_version is None or "0.45.2" not in bitsandbytes_version: + if bitsandbytes_version is None or (bitsandbytes_version and Version(bitsandbytes_version) < Version("0.45.2")): try: print("Installing bitsandbytes") pip_install("bitsandbytes>=0.45.2", "--prefer-binary") @@ -270,14 +263,15 @@ def check_versions(): dependencies = [ Dependency(module="accelerate", version="0.21.0"), - Dependency(module="diffusers", version="0.32.2") + Dependency(module="diffusers", version="0.32.2"), + Dependency(module="transformers", version="4.49.0") ] if device == "cuda": dependencies.append(Dependency(module="bitsandbytes", version="0.45.2", required=False)) if device != "mps": - dependencies.append(Dependency(module="xformers", version="0.0.21", required=False)) + dependencies.append(Dependency(module="xformers", version="0.0.27", required=False)) launch_errors = [] @@ -358,7 +352,7 @@ def print_bitsandbytes_installation_error(err): print("cd ../..") print("# WINDOWS ONLY: ") print( - "pip install --prefer-binary --force-reinstall https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.43.0.post2-py3-none-win_amd64.whl") + "pip install bitsandbytes>=0.45.2 --prefer-binary --force-reinstall") print("#######################################################################################################") @@ -369,7 +363,7 @@ def print_xformers_installation_error(err): print("# XFORMERS ISSUE DETECTED #") print("#######################################################################################################") print("#") - print(f"# Dreambooth could not find a compatible version of xformers (>= 0.0.21 built with torch {torch_ver})") + print(f"# Dreambooth could not find a compatible version of xformers (>= 0.0.27 built with torch {torch_ver})") print("# xformers will not be available for Dreambooth. Consider upgrading to Torch 2.") print("#") print("# Xformers installation exception:") @@ -401,7 +395,7 @@ def print_launch_errors(launch_errors): print("cd ../..") print("pip install -r ./extensions/sd_dreambooth_extension/requirements.txt") print( - "pip install --prefer-binary --force-reinstall https://github.com/jllllll/bitsandbytes-windows-webui/releases/download/wheels/bitsandbytes-0.43.0.post2-py3-none-win_amd64.whl") + "pip install bitsandbytes>=0.45.2 --prefer-binary --force-reinstall") print("#######################################################################################################") @@ -417,8 +411,8 @@ def check_torch_unsafe_load(): def print_xformers_torch1_instructions(xformers_version): print(f"# Your version of xformers is {xformers_version}.") - print("# xformers >= 0.0.21 is required to be available on the Dreambooth tab.") - print("# Torch 1 wheels of xformers >= 0.0.21 are no longer available on PyPI,") + print("# xformers >= 0.0.27 is required to be available on the Dreambooth tab.") + print("# Torch 1 wheels of xformers >= 0.0.27 are no longer available on PyPI,") print("# but you can manually download them by going to:") print("https://github.com/facebookresearch/xformers/actions") print("# Click on the most recent action tagged with a release (middle column).") diff --git a/requirements.txt b/requirements.txt index 753a43c..18b0f4c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,13 @@ -bitsandbytes>=0.45.2 accelerate>=0.21.0 +bitsandbytes>=0.45.2 dadaptation>=3.2 diffusers>=0.32.2 -discord-webhook==1.3.1 -fastapi +discord-webhook>=1.3.1 +fastapi>=0.94.0 gitpython>=3.1.32 -pytorch_optimizer==3.4.0 -Pillow -transformers>=4.48.3 -tqdm +pillow>=11.3.0 +pytorch_optimizer>=3.4.0 tomesd>=0.1.3 -xformers \ No newline at end of file +tqdm>=4.67.1 +transformers>=4.49.0 +xformers>=0.0.27.post2 \ No newline at end of file