2022-10-12 11:08:06 +00:00
|
|
|
@echo off
|
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem This script will install git and conda (if not found on the PATH variable)
|
2022-10-12 11:08:06 +00:00
|
|
|
@rem using micromamba (an 8mb static-linked single-file binary, conda replacement).
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem For users who already have git and conda, this step will be skipped.
|
2022-10-12 11:08:06 +00:00
|
|
|
|
|
|
|
@rem Next, it'll checkout the project's git repo, if necessary.
|
|
|
|
@rem Finally, it'll create the conda environment and preload the models.
|
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem This enables a user to install this project without manually installing conda and git.
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-10-26 10:05:42 +00:00
|
|
|
echo "Installing InvokeAI.."
|
|
|
|
echo.
|
|
|
|
|
2022-10-12 11:08:06 +00:00
|
|
|
@rem config
|
|
|
|
set MAMBA_ROOT_PREFIX=%cd%\installer_files\mamba
|
|
|
|
set INSTALL_ENV_DIR=%cd%\installer_files\env
|
2022-10-26 10:00:48 +00:00
|
|
|
set MICROMAMBA_DOWNLOAD_URL=https://github.com/cmdr2/stable-diffusion-ui/releases/download/v1.1/micromamba.exe
|
2022-10-30 16:13:11 +00:00
|
|
|
set REPO_URL=https://github.com/invoke-ai/InvokeAI.git
|
2022-10-29 14:17:55 +00:00
|
|
|
set umamba_exists=F
|
2022-10-26 10:00:48 +00:00
|
|
|
@rem Change the download URL to an InvokeAI repo's release URL
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem figure out whether git and conda needs to be installed
|
2022-10-26 10:00:48 +00:00
|
|
|
if exist "%INSTALL_ENV_DIR%" set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
|
|
|
|
|
2022-10-12 11:23:07 +00:00
|
|
|
set PACKAGES_TO_INSTALL=
|
|
|
|
|
2022-10-12 16:57:22 +00:00
|
|
|
call conda --version >.tmp1 2>.tmp2
|
2022-10-12 16:45:38 +00:00
|
|
|
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% conda
|
2022-10-12 11:23:07 +00:00
|
|
|
|
2022-10-12 16:57:22 +00:00
|
|
|
call git --version >.tmp1 2>.tmp2
|
2022-10-12 11:23:07 +00:00
|
|
|
if "%ERRORLEVEL%" NEQ "0" set PACKAGES_TO_INSTALL=%PACKAGES_TO_INSTALL% git
|
|
|
|
|
2022-10-29 14:17:55 +00:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version >.tmp1 2>.tmp2
|
|
|
|
if "%ERRORLEVEL%" EQU "0" set umamba_exists=T
|
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem (if necessary) install git and conda into a contained environment
|
2022-10-12 11:08:06 +00:00
|
|
|
if "%PACKAGES_TO_INSTALL%" NEQ "" (
|
2022-10-26 10:00:48 +00:00
|
|
|
@rem download micromamba
|
2022-10-29 14:17:55 +00:00
|
|
|
if "%umamba_exists%" == "F" (
|
2022-10-26 10:00:48 +00:00
|
|
|
echo "Downloading micromamba from %MICROMAMBA_DOWNLOAD_URL% to %MAMBA_ROOT_PREFIX%\micromamba.exe"
|
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
mkdir "%MAMBA_ROOT_PREFIX%"
|
2022-10-26 10:00:48 +00:00
|
|
|
call curl -L "%MICROMAMBA_DOWNLOAD_URL%" > "%MAMBA_ROOT_PREFIX%\micromamba.exe"
|
2022-10-12 16:45:38 +00:00
|
|
|
|
|
|
|
@rem test the mamba binary
|
|
|
|
echo Micromamba version:
|
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" --version
|
|
|
|
)
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
@rem create the installer env
|
2022-10-12 11:08:06 +00:00
|
|
|
if not exist "%INSTALL_ENV_DIR%" (
|
2022-10-12 16:45:38 +00:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" create -y --prefix "%INSTALL_ENV_DIR%"
|
2022-10-12 11:08:06 +00:00
|
|
|
)
|
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
echo "Packages to install:%PACKAGES_TO_INSTALL%"
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-10-12 16:45:38 +00:00
|
|
|
call "%MAMBA_ROOT_PREFIX%\micromamba.exe" install -y --prefix "%INSTALL_ENV_DIR%" -c conda-forge %PACKAGES_TO_INSTALL%
|
2022-10-26 10:00:48 +00:00
|
|
|
|
|
|
|
if not exist "%INSTALL_ENV_DIR%" (
|
|
|
|
echo "There was a problem while installing%PACKAGES_TO_INSTALL% using micromamba. Cannot continue."
|
|
|
|
pause
|
|
|
|
exit /b
|
|
|
|
)
|
2022-10-12 11:08:06 +00:00
|
|
|
)
|
|
|
|
|
2022-10-26 11:09:21 +00:00
|
|
|
set PATH=%INSTALL_ENV_DIR%;%INSTALL_ENV_DIR%\Library\bin;%INSTALL_ENV_DIR%\Scripts;%INSTALL_ENV_DIR%\Library\usr\bin;%PATH%
|
2022-10-12 16:45:38 +00:00
|
|
|
|
2022-10-12 11:08:06 +00:00
|
|
|
@rem get the repo (and load into the current directory)
|
|
|
|
if not exist ".git" (
|
|
|
|
call git init
|
2022-11-08 19:44:44 +00:00
|
|
|
call git config --local init.defaultBranch main
|
2022-10-26 10:08:49 +00:00
|
|
|
call git remote add origin %REPO_URL%
|
2022-10-12 11:08:06 +00:00
|
|
|
call git fetch
|
2022-10-30 16:20:28 +00:00
|
|
|
# call git checkout origin/main -ft
|
2022-11-08 12:56:36 +00:00
|
|
|
call git checkout origin/release-candidate-2-1-3 -ft
|
2022-10-12 11:08:06 +00:00
|
|
|
)
|
|
|
|
|
2022-10-26 10:00:48 +00:00
|
|
|
@rem activate the base env
|
|
|
|
call conda activate
|
|
|
|
|
2022-10-12 11:08:06 +00:00
|
|
|
@rem create the environment
|
2022-11-01 16:02:22 +00:00
|
|
|
call conda env remove -n invokeai
|
2022-11-10 11:21:43 +00:00
|
|
|
cp environments-and-requirements\environment-win-cuda.yml environment.yml
|
2022-10-12 16:45:38 +00:00
|
|
|
call conda env create
|
2022-11-01 17:54:42 +00:00
|
|
|
if "%ERRORLEVEL%" NEQ "0" (
|
2022-11-01 16:02:22 +00:00
|
|
|
echo ""
|
|
|
|
echo "Something went wrong while installing Python libraries and cannot continue.
|
|
|
|
echo "Please visit https://invoke-ai.github.io/InvokeAI/#installation for alternative"
|
|
|
|
echo "installation methods."
|
|
|
|
echo "Press any key to continue"
|
|
|
|
pause
|
|
|
|
exit /b
|
|
|
|
)
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-11-01 16:02:22 +00:00
|
|
|
call conda activate invokeai
|
2022-10-12 11:08:06 +00:00
|
|
|
@rem preload the models
|
|
|
|
call python scripts\preload_models.py
|
2022-11-01 17:54:42 +00:00
|
|
|
if "%ERRORLEVEL%" NEQ "0" (
|
2022-11-01 16:02:22 +00:00
|
|
|
echo ""
|
|
|
|
echo "The preload_models.py script crashed or was cancelled."
|
|
|
|
echo "InvokeAI is not ready to run. To run preload_models.py again,"
|
2022-11-02 19:26:02 +00:00
|
|
|
echo "run the command 'update.bat' in this directory."
|
2022-11-01 16:02:22 +00:00
|
|
|
echo "Press any key to continue"
|
|
|
|
pause
|
|
|
|
exit /b
|
|
|
|
)
|
2022-10-12 11:08:06 +00:00
|
|
|
|
2022-10-29 15:46:40 +00:00
|
|
|
@rem tell the user their next steps
|
2022-11-01 16:02:22 +00:00
|
|
|
echo ""
|
2022-11-01 17:54:42 +00:00
|
|
|
echo "* InvokeAI installed successfully *"
|
2022-10-29 15:46:40 +00:00
|
|
|
echo "You can now start generating images by double-clicking the 'invoke.bat' file (inside this folder)
|
2022-11-01 16:02:22 +00:00
|
|
|
echo "Press any key to continue"
|
2022-10-13 09:50:29 +00:00
|
|
|
pause
|
2022-11-01 16:02:22 +00:00
|
|
|
exit 0
|
|
|
|
|