Fancier [Y/N/B]

Fancier [Y/N/B], does not require for you to press the letter and then enter, and also asks you if you want to download the model instead of downloading it automatically if you don't have it.

Pressing B lets you open the link in the browser for a faster download because most browsers support multi-segment downloads. With Invoke-WebRequest it would take me ~30 minutes to download with a 200Mbps speed.

Also lets you retry the download if failed or disconnected.
This commit is contained in:
arroyoquiel 2023-04-07 05:40:08 -06:00 committed by GitHub
parent 79543b1edf
commit 6af9d54a47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,27 +125,51 @@ if %ERRORLEVEL% neq 0 (
) )
echo Downloading latest model echo Downloading latest model
IF NOT EXIST models ( if not exist models (
md models md models
) )
IF NOT EXIST models/gpt4all-lora-quantized-ggml.bin ( if not exist models/gpt4all-lora-quantized-ggml.bin (
powershell -Command "Invoke-WebRequest -Uri 'https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized-ggml.bin' -OutFile 'models/gpt4all-lora-quantized-ggml.bin'"
) ELSE (
:PROMPT
echo. echo.
set /p choice="The model file already exists. Do you want to override it? (y/n) " choice /C YNB /M "The default model file (gpt4all-lora-quantized-ggml.bin) does not exist. Do you want to download it? Press B to download it with a browser (faster)."
if /i {%choice%}=={y} ( if errorlevel 3 goto DOWNLOAD_WITH_BROWSER
powershell -Command "Invoke-WebRequest -Uri 'https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized-ggml.bin' -OutFile 'models/gpt4all-lora-quantized-ggml.bin'" && goto :CONTINUE if errorlevel 2 goto DOWNLOAD_SKIP
) else if /i {%choice%}=={n} ( if errorlevel 1 goto MODEL_DOWNLOAD
goto :CONTINUE ) ELSE (
) else ( echo.
echo. choice /C YNB /M "The default model file (gpt4all-lora-quantized-ggml.bin) already exists. Do you want to replace it? Press B to download it with a browser (faster)."
echo Invalid input. Please enter 'y' or 'n'. if errorlevel 3 goto DOWNLOAD_WITH_BROWSER
goto :PROMPT if errorlevel 2 goto DOWNLOAD_SKIP
) if errorlevel 1 goto MODEL_DOWNLOAD
) )
:DOWNLOAD_WITH_BROWSER
start https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized-ggml.bin
echo Link has been opened with the default web browser, make sure to save it into the models folder. Press any key to continue.
pause
goto :CONTINUE
:MODEL_DOWNLOAD
echo.
echo Downloading latest model...
powershell -Command "Invoke-WebRequest -Uri 'https://the-eye.eu/public/AI/models/nomic-ai/gpt4all/gpt4all-lora-quantized-ggml.bin' -OutFile 'models/gpt4all-lora-quantized-ggml.bin'"
if errorlevel 1 (
echo Failed to download model. Please check your internet connection.
choice /C YN /M "Do you want to try downloading again?"
if errorlevel 2 goto DOWNLOAD_SKIP
if errorlevel 1 goto MODEL_DOWNLOAD
) else (
echo Model successfully downloaded.
)
goto :CONTINUE
:DOWNLOAD_SKIP
echo.
echo Skipping download of model file...
goto :CONTINUE
:CONTINUE :CONTINUE
echo.
echo Cleaning tmp folder echo Cleaning tmp folder
rd /s /q "./tmp" rd /s /q "./tmp"