From d70f1fc72fdfab601bb2a9ebe6f4b0a23068c2cc Mon Sep 17 00:00:00 2001 From: glencoe2004 Date: Wed, 15 Mar 2023 18:23:48 -0400 Subject: [PATCH 1/3] Add files via upload --- Windows-installer.bat | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Windows-installer.bat diff --git a/Windows-installer.bat b/Windows-installer.bat new file mode 100644 index 0000000000000..1753fd7b700f8 --- /dev/null +++ b/Windows-installer.bat @@ -0,0 +1,39 @@ +@echo off +::Install Llama.cpp depencidies, such as Python and CMake (for building llama.exe and quantize.exe) + +if not defined PYTHON (set PYTHON=python) +if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv") + +%PYTHON% -V +if %ERRORLEVEL% == 0 goto :create_venv +echo Python is not installed, installing +goto :install_python + +:install_python +call bitsadmin /transfer Python-3.10.6 /download /priority FOREGROUND "https://www.python.org/ftp/python/3.10.6/python-3.10.6-amd64.exe" "%CD%/python-3.10.6-amd64.exe" +python-3.10.6-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 +call refreshenv +goto :create_venv + +:: Should probably impliment check for pip before installing dependicies +:create_venv +:: Check if venv already exists +dir "%VENV_DIR%\Scripts\Python.exe" -V +if %ERRORLEVEL% == 0 goto :ititiate_venv + +:: Otherwise create new venv +echo Creating venv in %VENV_DIR% +%PYTHON% -m venv "%VENV_DIR%" +if %ERRORLEVEL% == 0 goto :ititiate_venv +echo Unable to create venv in "%VENV_DIR%" +pause + +:ititiate_venv +set PYTHON="%VENV_DIR%\Scripts\Python.exe" +echo venv %PYTHON% +goto :install_depencidies + +:install_depencidies +%PYTHON% -m pip install cmake torch numpy sentencepiece %* +echo Llama depencidies are now installed! +pause \ No newline at end of file From 599b3ca1e729212c4e30c73c6ffa04f2d9a01996 Mon Sep 17 00:00:00 2001 From: glencoe2004 Date: Wed, 15 Mar 2023 18:53:24 -0400 Subject: [PATCH 2/3] Add files via upload --- Windows-model_conversion.bat | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Windows-model_conversion.bat diff --git a/Windows-model_conversion.bat b/Windows-model_conversion.bat new file mode 100644 index 0000000000000..e077fbb5d7a52 --- /dev/null +++ b/Windows-model_conversion.bat @@ -0,0 +1,31 @@ +@echo off +:: Convert models to 4 bit + +set "VENV_DIR=%~dp0%venv" +set PYTHON="%VENV_DIR%\Scripts\Python.exe" +echo venv is located at: %PYTHON% +goto :convert_ggml + +:: Convert the 7B model to ggml FP16 format +:convert_ggml +%PYTHON% "convert-pth-to-ggml.py" models/7B/ 1 +if %ERRORLEVEL% == 1 goto :fast_quit +goto :build_cmake + +:: Build llama.exe and quantize.exe +:build_cmake +cmake -S . -B build/ -D CMAKE_BUILD_TYPE=Release +cmake --build build/ --config Release +if %ERRORLEVEL% == 1 goto :fast_quit +goto :quantize + +:quantize +.\build\Release\quantize.exe .\models\7B\ggml-model-f16.bin .\models\7B\ggml-model-q4_0.bin 2 +echo All tasks completed successfully. +pause +exit + +:fast_quit +echo Something went wrong! +pause +exit \ No newline at end of file From 68e421da891c12ed3d5b347703c4a26f77195bad Mon Sep 17 00:00:00 2001 From: glencoe2004 Date: Wed, 15 Mar 2023 18:54:50 -0400 Subject: [PATCH 3/3] Grammar improvements and more information --- Windows-installer.bat | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Windows-installer.bat b/Windows-installer.bat index 1753fd7b700f8..9fc4b2ce65560 100644 --- a/Windows-installer.bat +++ b/Windows-installer.bat @@ -1,5 +1,5 @@ @echo off -::Install Llama.cpp depencidies, such as Python and CMake (for building llama.exe and quantize.exe) +::Install Llama.cpp dependencies, such as Python and CMake (for future building of llama.exe and quantize.exe) if not defined PYTHON (set PYTHON=python) if not defined VENV_DIR (set "VENV_DIR=%~dp0%venv") @@ -19,21 +19,25 @@ goto :create_venv :create_venv :: Check if venv already exists dir "%VENV_DIR%\Scripts\Python.exe" -V -if %ERRORLEVEL% == 0 goto :ititiate_venv +if %ERRORLEVEL% == 0 goto :initiate_venv :: Otherwise create new venv echo Creating venv in %VENV_DIR% %PYTHON% -m venv "%VENV_DIR%" -if %ERRORLEVEL% == 0 goto :ititiate_venv +if %ERRORLEVEL% == 0 goto :initiate_venv echo Unable to create venv in "%VENV_DIR%" pause +exit -:ititiate_venv +:: Activate venv +:initiate_venv set PYTHON="%VENV_DIR%\Scripts\Python.exe" echo venv %PYTHON% -goto :install_depencidies +goto :install_dependencies -:install_depencidies +:install_dependencies %PYTHON% -m pip install cmake torch numpy sentencepiece %* -echo Llama depencidies are now installed! -pause \ No newline at end of file +echo Llama.cpp dependencies are now installed! +echo Put your LLaMA models into the models folder, and run model_conversion to convert and quantize them. +pause +exit \ No newline at end of file