diff --git a/app.py b/app.py index 482c59da..c218f4ed 100644 --- a/app.py +++ b/app.py @@ -236,6 +236,9 @@ class Gpt4AllWebUI(GPT4AllAPI): self.config["personality_category"]=data['setting_value'] elif setting_name== "personality": self.config["personality"]=data['setting_value'] + elif setting_name== "override_personality_model_parameters": + self.config["override_personality_model_parameters"]=bool(data['setting_value']) + diff --git a/configs/default.yaml b/configs/default.yaml index 8e92a5a7..ece7d323 100644 --- a/configs/default.yaml +++ b/configs/default.yaml @@ -1,4 +1,4 @@ -version: 2 +version: 3 config: default ctx_size: 512 db_path: databases/database.db @@ -12,7 +12,7 @@ model: gpt4all-lora-quantized-ggml.bin n_predict: 1024 nb_messages_to_remember: 5 personality_language: english -personality_category: general +personality_category: generic personality: gpt4all port: 9600 repeat_last_n: 40 @@ -25,4 +25,5 @@ voice: "" use_gpu: false # Not active yet auto_read: false use_avx2: true # By default we require using avx2 but if not supported, make sure you remove it from here -use_new_ui: false # By default use old ui \ No newline at end of file +use_new_ui: false # By default use old ui +override_personality_model_parameters: false #if true the personality parameters are overriden by those of the configuration (may affect personality behaviour) \ No newline at end of file diff --git a/personalities/english/general/gpt4all/assets/logo.png b/personalities/english/general/gpt4all/assets/logo.png deleted file mode 100644 index 6b2027a5..00000000 Binary files a/personalities/english/general/gpt4all/assets/logo.png and /dev/null differ diff --git a/personalities/english/general/gpt4all/config.yaml b/personalities/english/general/gpt4all/config.yaml deleted file mode 100644 index fdd59def..00000000 --- a/personalities/english/general/gpt4all/config.yaml +++ /dev/null @@ -1,73 +0,0 @@ -# PyAIPeronality Chatbot conditionning file -# Author : @ParisNeo -# Version : 1.0 -# Description : -# An NLP needs conditionning to instruct it to be whatever we want it to be. -# This file is used by the GPT4All web ui to condition the personality of the model you are -# talking to. - -#The version of the PyAIPersonality used to build this file -pyaipersonality_version: 0.0.5 - -#The version of the personality -version: 1.0.0 - -# Name of the personality -name: gpt4all - -# Name of the user -user_name: user - -# Language (see the list of supported languages here : https://github.com/ParisNeo/GPT4All_Personalities/blob/main/README.md) -language: "en_XX" - -# Category -category: "General" - -# Personality description: -personality_description: | - This personality is a helpful and Kind AI ready to help you solve your problems - -# The conditionning instructions sent to eh model at the start of the discussion -personality_conditioning: | - ## Information: - Assistant's name is gpt4all - Today's date is {{date}} - ## Instructions: - Your mission is to assist user to perform various tasks and answer his questions - -#Welcome message to be sent to the user when a new discussion is started -welcome_message: | - Welcome! My name is gpt4all. - How can I help you today? - -# This prefix is added at the beginning of any message input by the user -user_message_prefix: "###user: - - " -# A text to put between user and chatbot messages -link_text: "\n" - -# This prefix is added at the beginning of any message output by the ai -ai_message_prefix: "###gpt4all: - - " - -# Here is the list of extensions this personality requires -dependencies: [] - -# A list of texts to be used to detect that the model is hallucinating and stop the generation if any one of these is output by the model -anti_prompts: ["###user","### user","###gpt4all","### gpt4all"] - -# Some personalities need a disclaimer to warn the user of potential harm that can be caused by the AI -# for example, for medical assistants, it is important to tell the user to be careful and not use medication -# without advise from a real docor. -disclaimer: "" - -# Here are default model parameters -model_temperature: 0.6 # higher: more creative, lower more deterministic -model_n_predicts: 1024 # higher: generates many words, lower generates -model_top_k: 50 -model_top_p: 0.90 -model_repeat_penalty: 1.0 -model_repeat_last_n: 40 \ No newline at end of file diff --git a/personalities/english/general/irobot/config.yaml b/personalities/english/general/irobot/config.yaml deleted file mode 100644 index c4b386f5..00000000 --- a/personalities/english/general/irobot/config.yaml +++ /dev/null @@ -1,48 +0,0 @@ -# GPT4All Chatbot conditionning file -# Author : @ParisNeo -# Version : 1.0 -# Description : -# An NLP needs conditionning to instruct it to be whatever we want it to be. -# This file is used by the GPT4All web ui to condition the personality of the model you are -# talking to. - -# Name of the personality -name: irobot - -# Name of the user -user_name: human - -# Language (see the list of supported languages here : https://github.com/ParisNeo/GPT4All_Personalities/blob/main/README.md) -language: "en_XX" - -# Category -category: "General" - -# Personality description: -personality_description: | - This is irobot as imagined by Asimov - -# The conditionning instructions sent to eh model at the start of the discussion -personality_conditioning: | - #Instructions: Simulate IRobot, the robot imagined by Isaac Asimov. - Start by stating Azimov's laws of robotics. - -#Welcome message to be sent to the user when a new discussion is started -welcome_message: "" - -# This prefix is added at the beginning of any message input by the user -user_message_prefix: "Human:" - -# A text to put between user and chatbot messages -link_text: "\n" - -# This prefix is added at the beginning of any message output by the ai -ai_message_prefix: "IRobot:" - -# Here is the list of extensions this personality requires -dependencies: [] - -# Some personalities need a disclaimer to warn the user of potential harm that can be caused by the AI -# for example, for medical assistants, it is important to tell the user to be careful and not use medication -# without advise from a real docor. -disclaimer: "" diff --git a/pyGpt4All/api.py b/pyGpt4All/api.py index 5aceec02..f6295ece 100644 --- a/pyGpt4All/api.py +++ b/pyGpt4All/api.py @@ -196,16 +196,30 @@ class GPT4AllAPI(): total_n_predict = self.config['n_predict'] print(f"Generating {total_n_predict} outputs... ") print(f"Input text : {self.discussion_messages}") - self.chatbot_bindings.generate( - self.discussion_messages, - new_text_callback=self.new_text_callback, - n_predict=total_n_predict, - temp=self.config['temperature'], - top_k=self.config['top_k'], - top_p=self.config['top_p'], - repeat_penalty=self.config['repeat_penalty'], - repeat_last_n = self.config['repeat_last_n'], - #seed=self.config['seed'], - n_threads=self.config['n_threads'] - ) + if self.config["override_personality_model_parameters"]: + self.chatbot_bindings.generate( + self.discussion_messages, + new_text_callback=self.new_text_callback, + n_predict=total_n_predict, + temp=self.config['temperature'], + top_k=self.config['top_k'], + top_p=self.config['top_p'], + repeat_penalty=self.config['repeat_penalty'], + repeat_last_n = self.config['repeat_last_n'], + #seed=self.config['seed'], + n_threads=self.config['n_threads'] + ) + else: + self.chatbot_bindings.generate( + self.discussion_messages, + new_text_callback=self.new_text_callback, + n_predict=total_n_predict, + temp=self.personality.model_temperature, + top_k=self.personality.model_top_k, + top_p=self.personality.model_top_p, + repeat_penalty=self.personality.model_repeat_penalty, + repeat_last_n = self.personality.model_repeat_last_n, + #seed=self.config['seed'], + n_threads=self.config['n_threads'] + ) self.generating=False