From afc851b405e9adc4079d1417d88078f58499bbfb Mon Sep 17 00:00:00 2001 From: arroyoquiel <81461845+arroyoquiel@users.noreply.github.com> Date: Fri, 7 Apr 2023 23:50:12 -0600 Subject: [PATCH 1/3] Fix for #27 As NJannasch mentioned, the model won't work unless the model gets changed by llama.cpp\migrate-ggml-2023-03-30-pr613.py. This batch works as follows 1) Activates the virtual environment and Runs the Python app. 2) If the model gives an error, it asks you [Y/N] if you want to fix the model, N exits the batch, Y fixes it. 3) It renames the model so it conserves the original, and then applies the fix as a new model. After that it tells that the model has been fixed. Press any key to restart. 4) Pressing a key makes the batch go to the start and the UI launches successfully. --- run.bat | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/run.bat b/run.bat index 78b98076..a7891f38 100644 --- a/run.bat +++ b/run.bat @@ -35,6 +35,33 @@ echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH echo HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH -echo on -call env/Scripts/activate.bat -python app.py %* \ No newline at end of file +REM Activate the virtual environment +call env\Scripts\activate.bat + +:RESTART +REM Run the Python app +python app.py %* +set app_result=%errorlevel% + +IF %app_result% EQU 0 ( + goto END +) ELSE ( + echo. + choice /C YN /M "The model file (gpt4all-lora-quantized-ggml.bin) appears to be invalid. Do you want to fix it?" + if errorlevel 2 goto END + if errorlevel 1 goto MODEL_FIX +) + +:MODEL_FIX +if not exist llama.cpp git clone https://github.com/ggerganov/llama.cpp.git +move models\gpt4all-lora-quantized-ggml.bin models\gpt4all-lora-quantized-ggml.bin.original +python llama.cpp\migrate-ggml-2023-03-30-pr613.py models\gpt4all-lora-quantized-ggml.bin.original models\gpt4all-lora-quantized-ggml.bin +echo The model file (gpt4all-lora-quantized-ggml.bin) has been fixed. Press any key to restart... +pause >nul +goto RESTART + +:END +REM Wait for user input before exiting +echo. +echo Press any key to exit... +pause >nul From 5a711de8d0dcb9c4c18ae13ee9593584bf8cb973 Mon Sep 17 00:00:00 2001 From: arroyoquiel <81461845+arroyoquiel@users.noreply.github.com> Date: Sat, 8 Apr 2023 00:01:40 -0600 Subject: [PATCH 2/3] Fix for #27 As NJannasch mentioned, the model won't work unless the model gets changed by llama.cpp\migrate-ggml-2023-03-30-pr613.py. This batch works as follows Activates the virtual environment and Runs the Python app. If the model gives an error, it asks you [Y/N] if you want to fix the model, N exits the batch, Y fixes it. It renames the model so it conserves the original, and then applies the fix as a new model. After that it tells that the model has been fixed. Press any key to restart. Pressing a key makes the batch go to the start and the UI launches successfully. Added a remark --- run.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run.bat b/run.bat index a7891f38..3d6ab34f 100644 --- a/run.bat +++ b/run.bat @@ -43,6 +43,7 @@ REM Run the Python app python app.py %* set app_result=%errorlevel% +REM Ask if user wants the model fixed IF %app_result% EQU 0 ( goto END ) ELSE ( @@ -52,6 +53,7 @@ IF %app_result% EQU 0 ( if errorlevel 1 goto MODEL_FIX ) +REM Git Clone, Renames the bad model and fixes it using the same original name :MODEL_FIX if not exist llama.cpp git clone https://github.com/ggerganov/llama.cpp.git move models\gpt4all-lora-quantized-ggml.bin models\gpt4all-lora-quantized-ggml.bin.original From da95046a6ed6a1ca46a465ad2b5754637c34c8f4 Mon Sep 17 00:00:00 2001 From: arroyoquiel <81461845+arroyoquiel@users.noreply.github.com> Date: Sat, 8 Apr 2023 00:04:40 -0600 Subject: [PATCH 3/3] Changed the name of the forced model This file loads gpt4all-lora-quantized.bin instead of gpt4all-lora-quantized-ggml.bin which is what the installer downloads --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index 9e085470..a8f71b73 100644 --- a/app.py +++ b/app.py @@ -468,7 +468,7 @@ if __name__ == "__main__": ) parser.add_argument( - "-m", "--model", type=str, default="gpt4all-lora-quantized.bin", help="Force using a specific model." + "-m", "--model", type=str, default="gpt4all-lora-quantized-ggml.bin", help="Force using a specific model." ) parser.add_argument( "--temp", type=float, default=0.1, help="Temperature parameter for the model."