diff --git a/CHANGES.md b/CHANGES.md index f858700e..7e61b5aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Our focus continues to remain on an easy installation experience, and an easy user-interface. While still remaining pretty powerful, in terms of features and speed. ### Detailed changelog +* 2.5.32 - 19 Apr 2023 - Automatically check for black images, and set full-precision if necessary (for attn). This means custom models based on Stable Diffusion v2.1 will just work, without needing special command-line arguments or editing of yaml config files. * 2.5.31 - 10 Apr 2023 - Reduce VRAM usage while upscaling. * 2.5.31 - 6 Apr 2023 - Allow seeds upto `4,294,967,295`. Thanks @ogmaresca. * 2.5.31 - 6 Apr 2023 - Buttons to show the previous/next image in the image popup. Thanks @ogmaresca. diff --git a/scripts/check_models.py b/scripts/check_models.py new file mode 100644 index 00000000..4b8d68c6 --- /dev/null +++ b/scripts/check_models.py @@ -0,0 +1,101 @@ +# this script runs inside the legacy "stable-diffusion" folder + +from sdkit.models import download_model, get_model_info_from_db +from sdkit.utils import hash_file_quick + +import os +import shutil +from glob import glob +import traceback + +models_base_dir = os.path.abspath(os.path.join("..", "models")) + +models_to_check = { + "stable-diffusion": [ + {"file_name": "sd-v1-4.ckpt", "model_id": "1.4"}, + ], + "gfpgan": [ + {"file_name": "GFPGANv1.4.pth", "model_id": "1.4"}, + ], + "realesrgan": [ + {"file_name": "RealESRGAN_x4plus.pth", "model_id": "x4plus"}, + {"file_name": "RealESRGAN_x4plus_anime_6B.pth", "model_id": "x4plus_anime_6"}, + ], + "vae": [ + {"file_name": "vae-ft-mse-840000-ema-pruned.ckpt", "model_id": "vae-ft-mse-840000-ema-pruned"}, + ], +} +MODEL_EXTENSIONS = { # copied from easydiffusion/model_manager.py + "stable-diffusion": [".ckpt", ".safetensors"], + "vae": [".vae.pt", ".ckpt", ".safetensors"], + "hypernetwork": [".pt", ".safetensors"], + "gfpgan": [".pth"], + "realesrgan": [".pth"], + "lora": [".ckpt", ".safetensors"], +} + + +def download_if_necessary(model_type: str, file_name: str, model_id: str): + model_path = os.path.join(models_base_dir, model_type, file_name) + expected_hash = get_model_info_from_db(model_type=model_type, model_id=model_id)["quick_hash"] + + other_models_exist = any_model_exists(model_type) + known_model_exists = os.path.exists(model_path) + known_model_is_corrupt = known_model_exists and hash_file_quick(model_path) != expected_hash + + if known_model_is_corrupt or (not other_models_exist and not known_model_exists): + print("> download", model_type, model_id) + download_model(model_type, model_id, download_base_dir=models_base_dir) + + +def init(): + migrate_legacy_model_location() + + for model_type, models in models_to_check.items(): + for model in models: + try: + download_if_necessary(model_type, model["file_name"], model["model_id"]) + except: + traceback.print_exc() + fail(model_type) + + print(model_type, "model(s) found.") + + +### utilities +def any_model_exists(model_type: str) -> bool: + extensions = MODEL_EXTENSIONS.get(model_type, []) + for ext in extensions: + if any(glob(f"{models_base_dir}/{model_type}/**/*{ext}", recursive=True)): + return True + + return False + + +def migrate_legacy_model_location(): + 'Move the models inside the legacy "stable-diffusion" folder, to their respective folders' + + for model_type, models in models_to_check.items(): + for model in models: + file_name = model["file_name"] + if os.path.exists(file_name): + dest_dir = os.path.join(models_base_dir, model_type) + os.makedirs(dest_dir, exist_ok=True) + shutil.move(file_name, os.path.join(dest_dir, file_name)) + + +def fail(model_name): + print( + f"""Error downloading the {model_name} model. Sorry about that, please try to: +1. Run this installer again. +2. If that doesn't fix it, please try to download the file manually. The address to download from, and the destination to save to are printed above this message. +3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB +4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues +Thanks!""" + ) + exit(1) + + +### start + +init() diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 416ad851..775724b8 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -1,13 +1,140 @@ -''' -This script checks if the given modules exist -''' +""" +This script checks and installs the required modules. -import sys -import pkgutil +This script runs inside the legacy "stable-diffusion" folder -modules = sys.argv[1:] -missing_modules = [] -for m in modules: - if pkgutil.find_loader(m) is None: - print('module', m, 'not found') - exit(1) +TODO - Maybe replace the bulk of this script with a call to `pip install -f requirements.txt`, with +a custom index URL depending on the platform. + +""" + +import os +from importlib.metadata import version as pkg_version +import platform +import traceback + +os_name = platform.system() + +modules_to_check = { + "torch": ("1.11.0", "1.13.1", "2.0.0"), + "torchvision": ("0.12.0", "0.14.1", "0.15.1"), + "sdkit": "1.0.80", + "stable-diffusion-sdkit": "2.1.4", + "rich": "12.6.0", + "uvicorn": "0.19.0", + "fastapi": "0.85.1", + # "xformers": "0.0.16", +} + + +def version(module_name: str) -> str: + try: + return pkg_version(module_name) + except: + return None + + +def install(module_name: str, module_version: str): + if module_name == "xformers" and (os_name == "Darwin" or is_amd_on_linux()): + return + + index_url = None + if module_name in ("torch", "torchvision"): + module_version, index_url = apply_torch_install_overrides(module_version) + + install_cmd = f"python -m pip install --upgrade {module_name}=={module_version}" + if index_url: + install_cmd += f" --index-url {index_url}" + if module_name == "sdkit" and version("sdkit") is not None: + install_cmd += " -q" + + print(">", install_cmd) + os.system(install_cmd) + + +def init(): + for module_name, allowed_versions in modules_to_check.items(): + if os.path.exists(f"../src/{module_name}"): + print(f"Skipping {module_name} update, since it's in developer/editable mode") + continue + + allowed_versions, latest_version = get_allowed_versions(module_name, allowed_versions) + + requires_install = False + if module_name in ("torch", "torchvision"): + if version(module_name) is None: # allow any torch version + requires_install = True + elif version(module_name) not in allowed_versions: + requires_install = True + + if requires_install: + try: + install(module_name, latest_version) + except: + traceback.print_exc() + fail(module_name) + + print(f"{module_name}: {version(module_name)}") + + +### utilities + + +def get_allowed_versions(module_name: str, allowed_versions: tuple): + allowed_versions = (allowed_versions,) if isinstance(allowed_versions, str) else allowed_versions + latest_version = allowed_versions[-1] + + if module_name in ("torch", "torchvision"): + allowed_versions = include_cuda_versions(allowed_versions) + + return allowed_versions, latest_version + + +def apply_torch_install_overrides(module_version: str): + index_url = None + if os_name == "Windows": + module_version += "+cu117" + index_url = "https://download.pytorch.org/whl/cu117" + elif is_amd_on_linux(): + index_url = "https://download.pytorch.org/whl/rocm5.4.2" + + return module_version, index_url + + +def include_cuda_versions(module_versions: tuple) -> tuple: + "Adds CUDA-specific versions to the list of allowed version numbers" + + allowed_versions = tuple(module_versions) + allowed_versions += tuple(f"{v}+cu116" for v in module_versions) + allowed_versions += tuple(f"{v}+cu117" for v in module_versions) + allowed_versions += tuple(f"{v}+rocm5.2" for v in module_versions) + allowed_versions += tuple(f"{v}+rocm5.4.2" for v in module_versions) + + return allowed_versions + + +def is_amd_on_linux(): + if os_name == "Linux": + with open("/proc/bus/pci/devices", "r") as f: + device_info = f.read() + if "amdgpu" in device_info and "nvidia" not in device_info: + return True + + return False + + +def fail(module_name): + print( + f"""Error installing {module_name}. Sorry about that, please try to: +1. Run this installer again. +2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting +3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB +4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues +Thanks!""" + ) + exit(1) + + +### start + +init() diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 9b461b78..ee702bb5 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -57,6 +57,7 @@ if "%update_branch%"=="" ( @xcopy sd-ui-files\ui ui /s /i /Y /q @copy sd-ui-files\scripts\on_sd_start.bat scripts\ /Y @copy sd-ui-files\scripts\check_modules.py scripts\ /Y +@copy sd-ui-files\scripts\check_models.py scripts\ /Y @copy "sd-ui-files\scripts\Start Stable Diffusion UI.cmd" . /Y @copy "sd-ui-files\scripts\Developer Console.cmd" . /Y diff --git a/scripts/on_env_start.sh b/scripts/on_env_start.sh index 39d3939e..4e73ca4e 100755 --- a/scripts/on_env_start.sh +++ b/scripts/on_env_start.sh @@ -43,6 +43,7 @@ cp -Rf sd-ui-files/ui . cp sd-ui-files/scripts/on_sd_start.sh scripts/ cp sd-ui-files/scripts/bootstrap.sh scripts/ cp sd-ui-files/scripts/check_modules.py scripts/ +cp sd-ui-files/scripts/check_models.py scripts/ cp sd-ui-files/scripts/start.sh . cp sd-ui-files/scripts/developer_console.sh . cp sd-ui-files/scripts/functions.sh scripts/ diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 7efd4577..e0b8c5fb 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -6,6 +6,7 @@ @copy sd-ui-files\scripts\on_env_start.bat scripts\ /Y @copy sd-ui-files\scripts\bootstrap.bat scripts\ /Y @copy sd-ui-files\scripts\check_modules.py scripts\ /Y +@copy sd-ui-files\scripts\check_models.py scripts\ /Y if exist "%cd%\profile" ( set USERPROFILE=%cd%\profile @@ -34,8 +35,6 @@ call conda activate @REM remove the old version of the dev console script, if it's still present if exist "Open Developer Console.cmd" del "Open Developer Console.cmd" -@REM @call python -c "import os; import shutil; frm = 'sd-ui-files\\ui\\hotfix\\9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'; dst = os.path.join(os.path.expanduser('~'), '.cache', 'huggingface', 'transformers', '9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'); shutil.copyfile(frm, dst) if os.path.exists(dst) else print(''); print('Hotfixed broken JSON file from OpenAI');" - @rem create the stable-diffusion folder, to work with legacy installations if not exist "stable-diffusion" mkdir stable-diffusion cd stable-diffusion @@ -49,111 +48,22 @@ if exist "env" ( if exist src rename src src-old if exist ldm rename ldm ldm-old -if not exist "..\models\stable-diffusion" mkdir "..\models\stable-diffusion" -if not exist "..\models\gfpgan" mkdir "..\models\gfpgan" -if not exist "..\models\realesrgan" mkdir "..\models\realesrgan" -if not exist "..\models\vae" mkdir "..\models\vae" - -@rem migrate the legacy models to the correct path (if already downloaded) -if exist "sd-v1-4.ckpt" move sd-v1-4.ckpt ..\models\stable-diffusion\ -if exist "custom-model.ckpt" move custom-model.ckpt ..\models\stable-diffusion\ -if exist "GFPGANv1.3.pth" move GFPGANv1.3.pth ..\models\gfpgan\ -if exist "RealESRGAN_x4plus.pth" move RealESRGAN_x4plus.pth ..\models\realesrgan\ -if exist "RealESRGAN_x4plus_anime_6B.pth" move RealESRGAN_x4plus_anime_6B.pth ..\models\realesrgan\ if not exist "%INSTALL_ENV_DIR%\DLLs\libssl-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libssl-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\" if not exist "%INSTALL_ENV_DIR%\DLLs\libcrypto-1_1-x64.dll" copy "%INSTALL_ENV_DIR%\Library\bin\libcrypto-1_1-x64.dll" "%INSTALL_ENV_DIR%\DLLs\" -@rem install torch and torchvision -call python ..\scripts\check_modules.py torch torchvision -if "%ERRORLEVEL%" EQU "0" ( - echo "torch and torchvision have already been installed." -) else ( - echo "Installing torch and torchvision.." - - @REM prevent from using packages from the user's home directory, to avoid conflicts - set PYTHONNOUSERSITE=1 - set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - - call python -m pip install --upgrade torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 || ( - echo "Error installing torch. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" - pause - exit /b - ) -) - +@rem install or upgrade the required modules set PATH=C:\Windows\System32;%PATH% -@rem install/upgrade sdkit -call python ..\scripts\check_modules.py sdkit sdkit.models ldm transformers numpy antlr4 gfpgan realesrgan -if "%ERRORLEVEL%" EQU "0" ( - echo "sdkit is already installed." +@REM prevent from using packages from the user's home directory, to avoid conflicts +set PYTHONNOUSERSITE=1 +set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - @rem skip sdkit upgrade if in developer-mode - if not exist "..\src\sdkit" ( - @REM prevent from using packages from the user's home directory, to avoid conflicts - set PYTHONNOUSERSITE=1 - set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - - call python -m pip install --upgrade sdkit==1.0.70 -q || ( - echo "Error updating sdkit" - ) - ) -) else ( - echo "Installing sdkit: https://pypi.org/project/sdkit/" - - @REM prevent from using packages from the user's home directory, to avoid conflicts - set PYTHONNOUSERSITE=1 - set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - - call python -m pip install sdkit==1.0.70 || ( - echo "Error installing sdkit. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" - pause - exit /b - ) -) - -call python -c "from importlib.metadata import version; print('sdkit version:', version('sdkit'))" - -@rem upgrade stable-diffusion-sdkit -call python -m pip install --upgrade stable-diffusion-sdkit==2.1.4 -q || ( - echo "Error updating stable-diffusion-sdkit" -) -call python -c "from importlib.metadata import version; print('stable-diffusion version:', version('stable-diffusion-sdkit'))" - -@rem install rich -call python ..\scripts\check_modules.py rich -if "%ERRORLEVEL%" EQU "0" ( - echo "rich has already been installed." -) else ( - echo "Installing rich.." - - set PYTHONNOUSERSITE=1 - set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - - call python -m pip install rich || ( - echo "Error installing rich. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" - pause - exit /b - ) -) - -set PATH=C:\Windows\System32;%PATH% - -call python ..\scripts\check_modules.py uvicorn fastapi -@if "%ERRORLEVEL%" EQU "0" ( - echo "Packages necessary for Easy Diffusion were already installed" -) else ( - @echo. & echo "Downloading packages necessary for Easy Diffusion..." & echo. - - set PYTHONNOUSERSITE=1 - set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages - - @call conda install -c conda-forge -y uvicorn fastapi || ( - echo "Error installing the packages necessary for Easy Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" - pause - exit /b - ) +@rem Download the required packages +call python ..\scripts\check_modules.py +if "%ERRORLEVEL%" NEQ "0" ( + pause + exit /b ) call WHERE uvicorn > .tmp @@ -169,160 +79,11 @@ call WHERE uvicorn > .tmp @echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt ) -@if exist "..\models\stable-diffusion\sd-v1-4.ckpt" ( - for %%I in ("..\models\stable-diffusion\sd-v1-4.ckpt") do if "%%~zI" EQU "4265380512" ( - echo "Data files (weights) necessary for Stable Diffusion were already downloaded. Using the HuggingFace 4 GB Model." - ) else ( - for %%J in ("..\models\stable-diffusion\sd-v1-4.ckpt") do if "%%~zJ" EQU "7703807346" ( - echo "Data files (weights) necessary for Stable Diffusion were already downloaded. Using the HuggingFace 7 GB Model." - ) else ( - for %%K in ("..\models\stable-diffusion\sd-v1-4.ckpt") do if "%%~zK" EQU "7703810927" ( - echo "Data files (weights) necessary for Stable Diffusion were already downloaded. Using the Waifu Model." - ) else ( - echo. & echo "The model file present at models\stable-diffusion\sd-v1-4.ckpt is invalid. It is only %%~zK bytes in size. Re-downloading.." & echo. - del "..\models\stable-diffusion\sd-v1-4.ckpt" - ) - ) - ) -) - -@if not exist "..\models\stable-diffusion\sd-v1-4.ckpt" ( - @echo. & echo "Downloading data files (weights) for Stable Diffusion.." & echo. - - @call curl -L -k https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt > ..\models\stable-diffusion\sd-v1-4.ckpt - - @if exist "..\models\stable-diffusion\sd-v1-4.ckpt" ( - for %%I in ("..\models\stable-diffusion\sd-v1-4.ckpt") do if "%%~zI" NEQ "4265380512" ( - echo. & echo "Error: The downloaded model file was invalid! Bytes downloaded: %%~zI" & echo. - echo. & echo "Error downloading the data files (weights) for Stable Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) - ) else ( - @echo. & echo "Error downloading the data files (weights) for Stable Diffusion. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) -) - - - -@if exist "..\models\gfpgan\GFPGANv1.3.pth" ( - for %%I in ("..\models\gfpgan\GFPGANv1.3.pth") do if "%%~zI" EQU "348632874" ( - echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded" - ) else ( - echo. & echo "The GFPGAN model file present at models\gfpgan\GFPGANv1.3.pth is invalid. It is only %%~zI bytes in size. Re-downloading.." & echo. - del "..\models\gfpgan\GFPGANv1.3.pth" - ) -) - -@if not exist "..\models\gfpgan\GFPGANv1.3.pth" ( - @echo. & echo "Downloading data files (weights) for GFPGAN (Face Correction).." & echo. - - @call curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > ..\models\gfpgan\GFPGANv1.3.pth - - @if exist "..\models\gfpgan\GFPGANv1.3.pth" ( - for %%I in ("..\models\gfpgan\GFPGANv1.3.pth") do if "%%~zI" NEQ "348632874" ( - echo. & echo "Error: The downloaded GFPGAN model file was invalid! Bytes downloaded: %%~zI" & echo. - echo. & echo "Error downloading the data files (weights) for GFPGAN (Face Correction). Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) - ) else ( - @echo. & echo "Error downloading the data files (weights) for GFPGAN (Face Correction). Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) -) - - - -@if exist "..\models\realesrgan\RealESRGAN_x4plus.pth" ( - for %%I in ("..\models\realesrgan\RealESRGAN_x4plus.pth") do if "%%~zI" EQU "67040989" ( - echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded" - ) else ( - echo. & echo "The RealESRGAN model file present at models\realesrgan\RealESRGAN_x4plus.pth is invalid. It is only %%~zI bytes in size. Re-downloading.." & echo. - del "..\models\realesrgan\RealESRGAN_x4plus.pth" - ) -) - -@if not exist "..\models\realesrgan\RealESRGAN_x4plus.pth" ( - @echo. & echo "Downloading data files (weights) for ESRGAN (Resolution Upscaling) x4plus.." & echo. - - @call curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > ..\models\realesrgan\RealESRGAN_x4plus.pth - - @if exist "..\models\realesrgan\RealESRGAN_x4plus.pth" ( - for %%I in ("..\models\realesrgan\RealESRGAN_x4plus.pth") do if "%%~zI" NEQ "67040989" ( - echo. & echo "Error: The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: %%~zI" & echo. - echo. & echo "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) - ) else ( - @echo. & echo "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) -) - - - -@if exist "..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth" ( - for %%I in ("..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth") do if "%%~zI" EQU "17938799" ( - echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded" - ) else ( - echo. & echo "The RealESRGAN model file present at models\realesrgan\RealESRGAN_x4plus_anime_6B.pth is invalid. It is only %%~zI bytes in size. Re-downloading.." & echo. - del "..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth" - ) -) - -@if not exist "..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth" ( - @echo. & echo "Downloading data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime.." & echo. - - @call curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > ..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth - - @if exist "..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth" ( - for %%I in ("..\models\realesrgan\RealESRGAN_x4plus_anime_6B.pth") do if "%%~zI" NEQ "17938799" ( - echo. & echo "Error: The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: %%~zI" & echo. - echo. & echo "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) - ) else ( - @echo. & echo "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) -) - - - -@if exist "..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt" ( - for %%I in ("..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt") do if "%%~zI" EQU "334695179" ( - echo "Data files (weights) necessary for the default VAE (sd-vae-ft-mse-original) were already downloaded" - ) else ( - echo. & echo "The default VAE (sd-vae-ft-mse-original) file present at models\vae\vae-ft-mse-840000-ema-pruned.ckpt is invalid. It is only %%~zI bytes in size. Re-downloading.." & echo. - del "..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt" - ) -) - -@if not exist "..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt" ( - @echo. & echo "Downloading data files (weights) for the default VAE (sd-vae-ft-mse-original).." & echo. - - @call curl -L -k https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt > ..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt - - @if exist "..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt" ( - for %%I in ("..\models\vae\vae-ft-mse-840000-ema-pruned.ckpt") do if "%%~zI" NEQ "334695179" ( - echo. & echo "Error: The downloaded default VAE (sd-vae-ft-mse-original) file was invalid! Bytes downloaded: %%~zI" & echo. - echo. & echo "Error downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) - ) else ( - @echo. & echo "Error downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. - pause - exit /b - ) +@rem Download the required models +call python ..\scripts\check_models.py +if "%ERRORLEVEL%" NEQ "0" ( + pause + exit /b ) @>nul findstr /m "sd_install_complete" ..\scripts\install_status.txt diff --git a/scripts/on_sd_start.sh b/scripts/on_sd_start.sh index fcf7dc53..858fa768 100755 --- a/scripts/on_sd_start.sh +++ b/scripts/on_sd_start.sh @@ -4,6 +4,7 @@ cp sd-ui-files/scripts/functions.sh scripts/ cp sd-ui-files/scripts/on_env_start.sh scripts/ cp sd-ui-files/scripts/bootstrap.sh scripts/ cp sd-ui-files/scripts/check_modules.py scripts/ +cp sd-ui-files/scripts/check_models.py scripts/ source ./scripts/functions.sh @@ -18,11 +19,6 @@ if [ -e "open_dev_console.sh" ]; then rm "open_dev_console.sh" fi -# python -c "import os; import shutil; frm = 'sd-ui-files/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'; dst = os.path.join(os.path.expanduser('~'), '.cache', 'huggingface', 'transformers', '9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142'); shutil.copyfile(frm, dst) if os.path.exists(dst) else print(''); print('Hotfixed broken JSON file from OpenAI');" - -# Caution, this file will make your eyes and brain bleed. It's such an unholy mess. -# Note to self: Please rewrite this in Python. For the sake of your own sanity. - # set the correct installer path (current vs legacy) if [ -e "installer_files/env" ]; then export INSTALL_ENV_DIR="$(pwd)/installer_files/env" @@ -44,258 +40,20 @@ fi if [ -e "src" ]; then mv src src-old; fi if [ -e "ldm" ]; then mv ldm ldm-old; fi -mkdir -p "../models/stable-diffusion" -mkdir -p "../models/gfpgan" -mkdir -p "../models/realesrgan" -mkdir -p "../models/vae" - -# migrate the legacy models to the correct path (if already downloaded) -if [ -e "sd-v1-4.ckpt" ]; then mv sd-v1-4.ckpt ../models/stable-diffusion/; fi -if [ -e "custom-model.ckpt" ]; then mv custom-model.ckpt ../models/stable-diffusion/; fi -if [ -e "GFPGANv1.3.pth" ]; then mv GFPGANv1.3.pth ../models/gfpgan/; fi -if [ -e "RealESRGAN_x4plus.pth" ]; then mv RealESRGAN_x4plus.pth ../models/realesrgan/; fi -if [ -e "RealESRGAN_x4plus_anime_6B.pth" ]; then mv RealESRGAN_x4plus_anime_6B.pth ../models/realesrgan/; fi - -OS_NAME=$(uname -s) -case "${OS_NAME}" in - Linux*) OS_NAME="linux";; - Darwin*) OS_NAME="macos";; - *) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit -esac - -# install torch and torchvision -if python ../scripts/check_modules.py torch torchvision; then - # temp fix for installations that installed torch 2.0 by mistake - if [ "$OS_NAME" == "linux" ]; then - python -m pip install --upgrade torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 -q - elif [ "$OS_NAME" == "macos" ]; then - python -m pip install --upgrade torch==1.13.1 torchvision==0.14.1 -q - fi - - echo "torch and torchvision have already been installed." -else - echo "Installing torch and torchvision.." - - export PYTHONNOUSERSITE=1 - export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages" - - if [ "$OS_NAME" == "linux" ]; then - if python -m pip install --upgrade torch==1.13.1+cu116 torchvision==0.14.1+cu116 --extra-index-url https://download.pytorch.org/whl/cu116 ; then - echo "Installed." - else - fail "torch install failed" - fi - elif [ "$OS_NAME" == "macos" ]; then - if python -m pip install --upgrade torch==1.13.1 torchvision==0.14.1 ; then - echo "Installed." - else - fail "torch install failed" - fi - fi +# Download the required packages +if ! python ../scripts/check_modules.py; then + read -p "Press any key to continue" + exit 1 fi -# install/upgrade sdkit -if python ../scripts/check_modules.py sdkit sdkit.models ldm transformers numpy antlr4 gfpgan realesrgan ; then - echo "sdkit is already installed." - - # skip sdkit upgrade if in developer-mode - if [ ! -e "../src/sdkit" ]; then - export PYTHONNOUSERSITE=1 - export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages" - - python -m pip install --upgrade sdkit==1.0.70 -q - fi -else - echo "Installing sdkit: https://pypi.org/project/sdkit/" - - export PYTHONNOUSERSITE=1 - export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages" - - if python -m pip install sdkit==1.0.70 ; then - echo "Installed." - else - fail "sdkit install failed" - fi +if ! command -v uvicorn &> /dev/null; then + fail "UI packages not found!" fi -python -c "from importlib.metadata import version; print('sdkit version:', version('sdkit'))" - -# upgrade stable-diffusion-sdkit -python -m pip install --upgrade stable-diffusion-sdkit==2.1.4 -q -python -c "from importlib.metadata import version; print('stable-diffusion version:', version('stable-diffusion-sdkit'))" - -# install rich -if python ../scripts/check_modules.py rich; then - echo "rich has already been installed." -else - echo "Installing rich.." - - export PYTHONNOUSERSITE=1 - export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages" - - if python -m pip install rich ; then - echo "Installed." - else - fail "Install failed for rich" - fi -fi - -if python ../scripts/check_modules.py uvicorn fastapi ; then - echo "Packages necessary for Easy Diffusion were already installed" -else - printf "\n\nDownloading packages necessary for Easy Diffusion..\n\n" - - export PYTHONNOUSERSITE=1 - export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages" - - if conda install -c conda-forge -y uvicorn fastapi ; then - echo "Installed. Testing.." - else - fail "'conda install uvicorn' failed" - fi - - if ! command -v uvicorn &> /dev/null; then - fail "UI packages not found!" - fi -fi - -if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then - model_size=`filesize "../models/stable-diffusion/sd-v1-4.ckpt"` - - if [ "$model_size" -eq "4265380512" ] || [ "$model_size" -eq "7703807346" ] || [ "$model_size" -eq "7703810927" ]; then - echo "Data files (weights) necessary for Stable Diffusion were already downloaded" - else - printf "\n\nThe model file present at models/stable-diffusion/sd-v1-4.ckpt is invalid. It is only $model_size bytes in size. Re-downloading.." - rm ../models/stable-diffusion/sd-v1-4.ckpt - fi -fi - -if [ ! -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then - echo "Downloading data files (weights) for Stable Diffusion.." - - curl -L -k https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt > ../models/stable-diffusion/sd-v1-4.ckpt - - if [ -f "../models/stable-diffusion/sd-v1-4.ckpt" ]; then - model_size=`filesize "../models/stable-diffusion/sd-v1-4.ckpt"` - if [ ! "$model_size" == "4265380512" ]; then - fail "The downloaded model file was invalid! Bytes downloaded: $model_size" - fi - else - fail "Error downloading the data files (weights) for Stable Diffusion" - fi -fi - - -if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then - model_size=`filesize "../models/gfpgan/GFPGANv1.3.pth"` - - if [ "$model_size" -eq "348632874" ]; then - echo "Data files (weights) necessary for GFPGAN (Face Correction) were already downloaded" - else - printf "\n\nThe model file present at models/gfpgan/GFPGANv1.3.pth is invalid. It is only $model_size bytes in size. Re-downloading.." - rm ../models/gfpgan/GFPGANv1.3.pth - fi -fi - -if [ ! -f "../models/gfpgan/GFPGANv1.3.pth" ]; then - echo "Downloading data files (weights) for GFPGAN (Face Correction).." - - curl -L -k https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth > ../models/gfpgan/GFPGANv1.3.pth - - if [ -f "../models/gfpgan/GFPGANv1.3.pth" ]; then - model_size=`filesize "../models/gfpgan/GFPGANv1.3.pth"` - if [ ! "$model_size" -eq "348632874" ]; then - fail "The downloaded GFPGAN model file was invalid! Bytes downloaded: $model_size" - fi - else - fail "Error downloading the data files (weights) for GFPGAN (Face Correction)." - fi -fi - - -if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then - model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus.pth"` - - if [ "$model_size" -eq "67040989" ]; then - echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus were already downloaded" - else - printf "\n\nThe model file present at models/realesrgan/RealESRGAN_x4plus.pth is invalid. It is only $model_size bytes in size. Re-downloading.." - rm ../models/realesrgan/RealESRGAN_x4plus.pth - fi -fi - -if [ ! -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then - echo "Downloading data files (weights) for ESRGAN (Resolution Upscaling) x4plus.." - - curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth > ../models/realesrgan/RealESRGAN_x4plus.pth - - if [ -f "../models/realesrgan/RealESRGAN_x4plus.pth" ]; then - model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus.pth"` - if [ ! "$model_size" -eq "67040989" ]; then - fail "The downloaded ESRGAN x4plus model file was invalid! Bytes downloaded: $model_size" - fi - else - fail "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus" - fi -fi - - -if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then - model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth"` - - if [ "$model_size" -eq "17938799" ]; then - echo "Data files (weights) necessary for ESRGAN (Resolution Upscaling) x4plus_anime were already downloaded" - else - printf "\n\nThe model file present at models/realesrgan/RealESRGAN_x4plus_anime_6B.pth is invalid. It is only $model_size bytes in size. Re-downloading.." - rm ../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth - fi -fi - -if [ ! -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then - echo "Downloading data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime.." - - curl -L -k https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth > ../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth - - if [ -f "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth" ]; then - model_size=`filesize "../models/realesrgan/RealESRGAN_x4plus_anime_6B.pth"` - if [ ! "$model_size" -eq "17938799" ]; then - fail "The downloaded ESRGAN x4plus_anime model file was invalid! Bytes downloaded: $model_size" - fi - else - fail "Error downloading the data files (weights) for ESRGAN (Resolution Upscaling) x4plus_anime." - fi -fi - - -if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then - model_size=`filesize "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt"` - - if [ "$model_size" -eq "334695179" ]; then - echo "Data files (weights) necessary for the default VAE (sd-vae-ft-mse-original) were already downloaded" - else - printf "\n\nThe model file present at models/vae/vae-ft-mse-840000-ema-pruned.ckpt is invalid. It is only $model_size bytes in size. Re-downloading.." - rm ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt - fi -fi - -if [ ! -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then - echo "Downloading data files (weights) for the default VAE (sd-vae-ft-mse-original).." - - curl -L -k https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt > ../models/vae/vae-ft-mse-840000-ema-pruned.ckpt - - if [ -f "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt" ]; then - model_size=`filesize "../models/vae/vae-ft-mse-840000-ema-pruned.ckpt"` - if [ ! "$model_size" -eq "334695179" ]; then - printf "\n\nError: The downloaded default VAE (sd-vae-ft-mse-original) file was invalid! Bytes downloaded: $model_size\n\n" - printf "\n\nError downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n" - read -p "Press any key to continue" - exit - fi - else - printf "\n\nError downloading the data files (weights) for the default VAE (sd-vae-ft-mse-original). Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting\n 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n" - read -p "Press any key to continue" - exit - fi +# Download the required models +if ! python ../scripts/check_models.py; then + read -p "Press any key to continue" + exit 1 fi if [ `grep -c sd_install_complete ../scripts/install_status.txt` -gt "0" ]; then diff --git a/ui/easydiffusion/model_manager.py b/ui/easydiffusion/model_manager.py index 296c4192..dc727eeb 100644 --- a/ui/easydiffusion/model_manager.py +++ b/ui/easydiffusion/model_manager.py @@ -49,6 +49,7 @@ def load_default_models(context: Context): except Exception as e: log.error(f"[red]Error while loading {model_type} model: {context.model_paths[model_type]}[/red]") log.exception(e) + del context.model_paths[model_type] def unload_all(context: Context): for model_type in KNOWN_MODEL_TYPES: @@ -245,6 +246,7 @@ def getModels(): except MaliciousModelException as e: models["scan-error"] = e + log.info(f"[green]Scanning all model folders for models...[/]") # custom models listModels(model_type="stable-diffusion") listModels(model_type="vae") diff --git a/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142 b/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142 deleted file mode 100644 index 2c19f666..00000000 --- a/ui/hotfix/9c24e6cd9f499d02c4f21a033736dabd365962dc80fe3aeb57a8f85ea45a20a3.26fead7ea4f0f843f6eb4055dfd25693f1a71f3c6871b184042d4b126244e142 +++ /dev/null @@ -1,171 +0,0 @@ -{ - "_name_or_path": "clip-vit-large-patch14/", - "architectures": [ - "CLIPModel" - ], - "initializer_factor": 1.0, - "logit_scale_init_value": 2.6592, - "model_type": "clip", - "projection_dim": 768, - "text_config": { - "_name_or_path": "", - "add_cross_attention": false, - "architectures": null, - "attention_dropout": 0.0, - "bad_words_ids": null, - "bos_token_id": 0, - "chunk_size_feed_forward": 0, - "cross_attention_hidden_size": null, - "decoder_start_token_id": null, - "diversity_penalty": 0.0, - "do_sample": false, - "dropout": 0.0, - "early_stopping": false, - "encoder_no_repeat_ngram_size": 0, - "eos_token_id": 2, - "finetuning_task": null, - "forced_bos_token_id": null, - "forced_eos_token_id": null, - "hidden_act": "quick_gelu", - "hidden_size": 768, - "id2label": { - "0": "LABEL_0", - "1": "LABEL_1" - }, - "initializer_factor": 1.0, - "initializer_range": 0.02, - "intermediate_size": 3072, - "is_decoder": false, - "is_encoder_decoder": false, - "label2id": { - "LABEL_0": 0, - "LABEL_1": 1 - }, - "layer_norm_eps": 1e-05, - "length_penalty": 1.0, - "max_length": 20, - "max_position_embeddings": 77, - "min_length": 0, - "model_type": "clip_text_model", - "no_repeat_ngram_size": 0, - "num_attention_heads": 12, - "num_beam_groups": 1, - "num_beams": 1, - "num_hidden_layers": 12, - "num_return_sequences": 1, - "output_attentions": false, - "output_hidden_states": false, - "output_scores": false, - "pad_token_id": 1, - "prefix": null, - "problem_type": null, - "projection_dim" : 768, - "pruned_heads": {}, - "remove_invalid_values": false, - "repetition_penalty": 1.0, - "return_dict": true, - "return_dict_in_generate": false, - "sep_token_id": null, - "task_specific_params": null, - "temperature": 1.0, - "tie_encoder_decoder": false, - "tie_word_embeddings": true, - "tokenizer_class": null, - "top_k": 50, - "top_p": 1.0, - "torch_dtype": null, - "torchscript": false, - "transformers_version": "4.16.0.dev0", - "use_bfloat16": false, - "vocab_size": 49408 - }, - "text_config_dict": { - "hidden_size": 768, - "intermediate_size": 3072, - "num_attention_heads": 12, - "num_hidden_layers": 12, - "projection_dim": 768 - }, - "torch_dtype": "float32", - "transformers_version": null, - "vision_config": { - "_name_or_path": "", - "add_cross_attention": false, - "architectures": null, - "attention_dropout": 0.0, - "bad_words_ids": null, - "bos_token_id": null, - "chunk_size_feed_forward": 0, - "cross_attention_hidden_size": null, - "decoder_start_token_id": null, - "diversity_penalty": 0.0, - "do_sample": false, - "dropout": 0.0, - "early_stopping": false, - "encoder_no_repeat_ngram_size": 0, - "eos_token_id": null, - "finetuning_task": null, - "forced_bos_token_id": null, - "forced_eos_token_id": null, - "hidden_act": "quick_gelu", - "hidden_size": 1024, - "id2label": { - "0": "LABEL_0", - "1": "LABEL_1" - }, - "image_size": 224, - "initializer_factor": 1.0, - "initializer_range": 0.02, - "intermediate_size": 4096, - "is_decoder": false, - "is_encoder_decoder": false, - "label2id": { - "LABEL_0": 0, - "LABEL_1": 1 - }, - "layer_norm_eps": 1e-05, - "length_penalty": 1.0, - "max_length": 20, - "min_length": 0, - "model_type": "clip_vision_model", - "no_repeat_ngram_size": 0, - "num_attention_heads": 16, - "num_beam_groups": 1, - "num_beams": 1, - "num_hidden_layers": 24, - "num_return_sequences": 1, - "output_attentions": false, - "output_hidden_states": false, - "output_scores": false, - "pad_token_id": null, - "patch_size": 14, - "prefix": null, - "problem_type": null, - "projection_dim" : 768, - "pruned_heads": {}, - "remove_invalid_values": false, - "repetition_penalty": 1.0, - "return_dict": true, - "return_dict_in_generate": false, - "sep_token_id": null, - "task_specific_params": null, - "temperature": 1.0, - "tie_encoder_decoder": false, - "tie_word_embeddings": true, - "tokenizer_class": null, - "top_k": 50, - "top_p": 1.0, - "torch_dtype": null, - "torchscript": false, - "transformers_version": "4.16.0.dev0", - "use_bfloat16": false - }, - "vision_config_dict": { - "hidden_size": 1024, - "intermediate_size": 4096, - "num_attention_heads": 16, - "num_hidden_layers": 24, - "patch_size": 14, - "projection_dim": 768 - } -} diff --git a/ui/index.html b/ui/index.html index 7e8680d0..404d88af 100644 --- a/ui/index.html +++ b/ui/index.html @@ -30,7 +30,7 @@