From 1e06ac2ebd1507102d8a27070e595bac3f104797 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Wed, 11 Oct 2023 13:33:28 +0200 Subject: [PATCH] added fastgen to personalities --- lollms/personality.py | 24 +++++++++++++++++++++++- setup.py | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lollms/personality.py b/lollms/personality.py index cf28543..79a10a2 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -4,7 +4,7 @@ from lollms.config import InstallOption, TypedConfig, BaseConfig from lollms.main_config import LOLLMSConfig from lollms.paths import LollmsPaths from lollms.binding import LLMBinding - +from lollms.utilities import PromptReshaper import pkg_resources from pathlib import Path from PIL import Image @@ -1482,6 +1482,28 @@ class APScript(StateMachine): if callback: callback(message_text, MSG_TYPE.MSG_TYPE_FINISHED_MESSAGE) + def print_prompt(self, title, prompt): + ASCIIColors.red("*-*-*-*-*-*-*-* ", end="") + ASCIIColors.red(title, end="") + ASCIIColors.red(" *-*-*-*-*-*-*-*") + ASCIIColors.yellow(prompt) + ASCIIColors.red(" *-*-*-*-*-*-*-*") + + def fast_gen(self, prompt, max_generation_size, placeholders={}, debug=False): + """ + Fast way to generate code + """ + pr = PromptReshaper(prompt) + prompt = pr.build(placeholders, + self.personality.model.tokenize, + self.personality.model.detokenize, + self.personality.model.config.ctx_size, + ["previous_discussion"] + ) + self.print_prompt("Ask to build keywords",prompt) + return self.generate(prompt, max_generation_size).strip().replace("","").replace("","") + + #Helper method to convert outputs path to url def path2url(file): file = str(file).replace("\\","/") diff --git a/setup.py b/setup.py index d4dca84..d644c4f 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="5.7.3", + version="5.7.5", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition",