Moving to new version of pyllamacpp

This commit is contained in:
saloui 2023-05-02 11:02:59 +02:00
parent f83b9261b6
commit bfd2cfe48d
4 changed files with 59 additions and 2 deletions

55
add_backend.bat Normal file
View File

@ -0,0 +1,55 @@
@echo off
setlocal enabledelayedexpansion
REM Clone the repository to a tmp folder
set "REPO_URL=https://github.com/ParisNeo/PyAIPersonality.git"
set "TMP_FOLDER=%temp%\PyAIPersonality"
git clone %REPO_URL% %TMP_FOLDER%
REM List the available languages and prompt user to select one
set "LANGUAGES_FOLDER=%TMP_FOLDER%\personalities_zoo"
set "LANGUAGE_INDEX=0"
for /d %%d in ("%LANGUAGES_FOLDER%\*") do (
set /a "LANGUAGE_INDEX+=1"
set "LANGUAGES[!LANGUAGE_INDEX!]=%%~nxd"
echo !LANGUAGE_INDEX!. %%~nxd
)
set /p "SELECTED_LANGUAGE=Enter the number of the desired language: "
set "LANGUAGE_FOLDER=%LANGUAGES_FOLDER%\!LANGUAGES[%SELECTED_LANGUAGE%]!"
REM List the available categories and prompt user to select one
set "CATEGORIES_FOLDER=%LANGUAGE_FOLDER%"
set "CATEGORY_INDEX=0"
for /d %%d in ("%CATEGORIES_FOLDER%\*") do (
set /a "CATEGORY_INDEX+=1"
set "CATEGORIES[!CATEGORY_INDEX!]=%%~nxd"
echo !CATEGORY_INDEX!. %%~nxd
)
set /p "SELECTED_CATEGORY=Enter the number of the desired category: "
set "CATEGORY_FOLDER=%CATEGORIES_FOLDER%\!CATEGORIES[%SELECTED_CATEGORY%]!"
REM List the available personalities and prompt user to select one
set "PERSONALITIES_FOLDER=%CATEGORY_FOLDER%"
set "PERSONALITY_INDEX=0"
for /d %%d in ("%PERSONALITIES_FOLDER%\*") do (
set /a "PERSONALITY_INDEX+=1"
set "PERSONALITIES[!PERSONALITY_INDEX!]=%%~nxd"
echo !PERSONALITY_INDEX!. %%~nxd
)
set /p "SELECTED_PERSONALITY=Enter the number of the desired personality: "
set "PERSONALITY_FOLDER=%PERSONALITIES_FOLDER%\!PERSONALITIES[%SELECTED_PERSONALITY%]!"
REM Copy the selected personality folder to personalities/language/category folder
set "OUTPUT_FOLDER=%CD%\personalities\!LANGUAGES[%SELECTED_LANGUAGE%]!\!CATEGORIES[%SELECTED_CATEGORY%]!\!PERSONALITIES[%SELECTED_PERSONALITY%]!"
if not exist "%OUTPUT_FOLDER%" mkdir "%OUTPUT_FOLDER%"
xcopy /e /y "%PERSONALITY_FOLDER%" "%OUTPUT_FOLDER%"
REM cleaning
if exist "./tmp" (
echo Cleaning tmp folder
rd /s /q "./tmp"
)
REM Remove the tmp folder
rd /s /q "%TMP_FOLDER%"
echo Done
pause

1
app.py
View File

@ -342,6 +342,7 @@ class Gpt4AllWebUI(GPT4AllAPI):
def stop_gen(self):
self.cancel_gen = True
print("Stop generation received")
return jsonify({"status": "ok"})
def rename(self):

View File

@ -30,8 +30,8 @@ class LLAMACPP(GPTBackend):
super().__init__(config, False)
self.model = Model(
ggml_model=f"./models/llama_cpp/{self.config['model']}",
prompt_context="", prompt_prefix="", prompt_suffix="", anti_prompts= [],
model_path=f"./models/llama_cpp/{self.config['model']}",
prompt_context="", prompt_prefix="", prompt_suffix="",
n_ctx=self.config['ctx_size'],
seed=self.config['seed'],
)

View File

@ -81,6 +81,7 @@ function update_main(){
.then(response => response.json())
.then(data => {
console.log(data);
socket.disconnect()
});
})