mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-01-30 08:03:57 +00:00
Upgraded code to add personal information to the context and add vision models
This commit is contained in:
parent
9fb89ad44a
commit
911f2e9567
@ -14,7 +14,7 @@ from lollms.config import InstallOption
|
|||||||
from lollms.types import MSG_TYPE, SENDER_TYPES
|
from lollms.types import MSG_TYPE, SENDER_TYPES
|
||||||
from lollms.extension import LOLLMSExtension, ExtensionBuilder
|
from lollms.extension import LOLLMSExtension, ExtensionBuilder
|
||||||
from lollms.personality import AIPersonality, PersonalityBuilder
|
from lollms.personality import AIPersonality, PersonalityBuilder
|
||||||
from lollms.binding import LOLLMSConfig, BindingBuilder, LLMBinding, ModelBuilder
|
from lollms.binding import LOLLMSConfig, BindingBuilder, LLMBinding, ModelBuilder, BindingType
|
||||||
from lollms.paths import LollmsPaths
|
from lollms.paths import LollmsPaths
|
||||||
from lollms.helpers import ASCIIColors, trace_exception
|
from lollms.helpers import ASCIIColors, trace_exception
|
||||||
from lollms.app import LollmsApplication
|
from lollms.app import LollmsApplication
|
||||||
@ -1362,7 +1362,6 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
ASCIIColors.bold("HISTORY")
|
ASCIIColors.bold("HISTORY")
|
||||||
ASCIIColors.yellow(history)
|
ASCIIColors.yellow(history)
|
||||||
ASCIIColors.bold("DISCUSSION")
|
ASCIIColors.bold("DISCUSSION")
|
||||||
# TODO: upghrade to asciicolors 0.1.4
|
|
||||||
ASCIIColors.hilight(discussion_messages,"!@>",ASCIIColors.color_yellow,ASCIIColors.color_bright_red,False)
|
ASCIIColors.hilight(discussion_messages,"!@>",ASCIIColors.color_yellow,ASCIIColors.color_bright_red,False)
|
||||||
ASCIIColors.bold("Final prompt")
|
ASCIIColors.bold("Final prompt")
|
||||||
ASCIIColors.hilight(prompt_data,"!@>",ASCIIColors.color_yellow,ASCIIColors.color_bright_red,False)
|
ASCIIColors.hilight(prompt_data,"!@>",ASCIIColors.color_yellow,ASCIIColors.color_bright_red,False)
|
||||||
@ -1642,33 +1641,64 @@ class LoLLMsAPPI(LollmsApplication):
|
|||||||
self.nb_received_tokens = 0
|
self.nb_received_tokens = 0
|
||||||
self.start_time = datetime.now()
|
self.start_time = datetime.now()
|
||||||
if self.model is not None:
|
if self.model is not None:
|
||||||
ASCIIColors.info(f"warmup for generating up to {n_predict} tokens")
|
if self.model.binding_type==BindingType.TEXT_IMAGE and len(self.personality.image_files)>0:
|
||||||
if self.config["override_personality_model_parameters"]:
|
ASCIIColors.info(f"warmup for generating up to {n_predict} tokens")
|
||||||
output = self.model.generate(
|
if self.config["override_personality_model_parameters"]:
|
||||||
prompt,
|
output = self.model.generate_with_images(
|
||||||
callback=callback,
|
prompt,
|
||||||
n_predict=n_predict,
|
self.personality.image_files,
|
||||||
temperature=self.config['temperature'],
|
callback=callback,
|
||||||
top_k=self.config['top_k'],
|
n_predict=n_predict,
|
||||||
top_p=self.config['top_p'],
|
temperature=self.config['temperature'],
|
||||||
repeat_penalty=self.config['repeat_penalty'],
|
top_k=self.config['top_k'],
|
||||||
repeat_last_n = self.config['repeat_last_n'],
|
top_p=self.config['top_p'],
|
||||||
seed=self.config['seed'],
|
repeat_penalty=self.config['repeat_penalty'],
|
||||||
n_threads=self.config['n_threads']
|
repeat_last_n = self.config['repeat_last_n'],
|
||||||
)
|
seed=self.config['seed'],
|
||||||
|
n_threads=self.config['n_threads']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
output = self.model.generate_with_images(
|
||||||
|
prompt,
|
||||||
|
self.personality.image_files,
|
||||||
|
callback=callback,
|
||||||
|
n_predict=min(n_predict,self.personality.model_n_predicts),
|
||||||
|
temperature=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']
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
output = self.model.generate(
|
ASCIIColors.info(f"warmup for generating up to {n_predict} tokens")
|
||||||
prompt,
|
if self.config["override_personality_model_parameters"]:
|
||||||
callback=callback,
|
output = self.model.generate(
|
||||||
n_predict=min(n_predict,self.personality.model_n_predicts),
|
prompt,
|
||||||
temperature=self.personality.model_temperature,
|
callback=callback,
|
||||||
top_k=self.personality.model_top_k,
|
n_predict=n_predict,
|
||||||
top_p=self.personality.model_top_p,
|
temperature=self.config['temperature'],
|
||||||
repeat_penalty=self.personality.model_repeat_penalty,
|
top_k=self.config['top_k'],
|
||||||
repeat_last_n = self.personality.model_repeat_last_n,
|
top_p=self.config['top_p'],
|
||||||
seed=self.config['seed'],
|
repeat_penalty=self.config['repeat_penalty'],
|
||||||
n_threads=self.config['n_threads']
|
repeat_last_n = self.config['repeat_last_n'],
|
||||||
)
|
seed=self.config['seed'],
|
||||||
|
n_threads=self.config['n_threads']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
output = self.model.generate(
|
||||||
|
prompt,
|
||||||
|
callback=callback,
|
||||||
|
n_predict=min(n_predict,self.personality.model_n_predicts),
|
||||||
|
temperature=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']
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print("No model is installed or selected. Please make sure to install a model and select it inside your configuration before attempting to communicate with the model.")
|
print("No model is installed or selected. Please make sure to install a model and select it inside your configuration before attempting to communicate with the model.")
|
||||||
print("To do this: Install the model to your models/<binding name> folder.")
|
print("To do this: Install the model to your models/<binding name> folder.")
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 2e19dcd425cc36ed8f624771363a28f6f5589343
|
Subproject commit 9ea8ea114cf4f2ad2ec592ef50b425b68f43917b
|
@ -1 +1 @@
|
|||||||
Subproject commit 0b4349d69b78f35abeefc520e9891e263964d0b2
|
Subproject commit ba1306e8e955b8c8822f0f7f2d4a032d4e4de1d0
|
Loading…
x
Reference in New Issue
Block a user