sleepdeep/llm-deploy
0
1@echo off2 3cd /D "%~dp0"4 5set PATH=%PATH%;%SystemRoot%\system326 7echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end8 9@rem Check for special characters in installation path10set "SPCHARMESSAGE="WARNING: Special characters were detected in the installation path!" " This can cause the installation to fail!""11echo "%CD%"| findstr /R /C:"[!#\$%&()\*+,;<=>?@\[\]\^`{|}~]" >nul && (12 call :PrintBigMessage %SPCHARMESSAGE%13)14set SPCHARMESSAGE=15 16@rem fix failed install when installing to a separate drive17set TMP=%cd%\installer_files18set TEMP=%cd%\installer_files19 20@rem deactivate existing conda envs as needed to avoid conflicts21(call conda deactivate && call conda deactivate && call conda deactivate) 2>nul22 23@rem config24set INSTALL_DIR=%cd%\installer_files25set CONDA_ROOT_PREFIX=%cd%\installer_files\conda26set INSTALL_ENV_DIR=%cd%\installer_files\env27set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_23.3.1-0-Windows-x86_64.exe28set conda_exists=F29 30@rem figure out whether git and conda needs to be installed31call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&132if "%ERRORLEVEL%" EQU "0" set conda_exists=T33 34@rem (if necessary) install git and conda into a contained environment35@rem download conda36if "%conda_exists%" == "F" (37 echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe38 39 mkdir "%INSTALL_DIR%"40 call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end )41 42 echo Installing Miniconda to %CONDA_ROOT_PREFIX%43 start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX%44 45 @rem test the conda binary46 echo Miniconda version:47 call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end )48)49 50@rem create the installer env51if not exist "%INSTALL_ENV_DIR%" (52 echo Packages to install: %PACKAGES_TO_INSTALL%53 call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.11 || ( echo. && echo Conda environment creation failed. && goto end )54)55 56@rem check if conda environment was actually created57if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end )58 59@rem environment isolation60set PYTHONNOUSERSITE=161set PYTHONPATH=62set PYTHONHOME=63set "CUDA_PATH=%INSTALL_ENV_DIR%"64set "CUDA_HOME=%CUDA_PATH%"65 66@rem activate installer env67call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end )68 69@rem setup installer env70call python one_click.py %*71 72@rem below are functions for the script next line skips these during normal execution73goto end74 75:PrintBigMessage76echo. && echo.77echo *******************************************************************78for %%M in (%*) do echo * %%~M79echo *******************************************************************80echo. && echo.81exit /b82 83:end84pause85 