mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 20:57:58 +00:00
added fastgen to personalities
This commit is contained in:
parent
a9aed879f9
commit
1e06ac2ebd
@ -4,7 +4,7 @@ from lollms.config import InstallOption, TypedConfig, BaseConfig
|
|||||||
from lollms.main_config import LOLLMSConfig
|
from lollms.main_config import LOLLMSConfig
|
||||||
from lollms.paths import LollmsPaths
|
from lollms.paths import LollmsPaths
|
||||||
from lollms.binding import LLMBinding
|
from lollms.binding import LLMBinding
|
||||||
|
from lollms.utilities import PromptReshaper
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
@ -1482,6 +1482,28 @@ class APScript(StateMachine):
|
|||||||
if callback:
|
if callback:
|
||||||
callback(message_text, MSG_TYPE.MSG_TYPE_FINISHED_MESSAGE)
|
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("</s>","").replace("<s>","")
|
||||||
|
|
||||||
|
|
||||||
#Helper method to convert outputs path to url
|
#Helper method to convert outputs path to url
|
||||||
def path2url(file):
|
def path2url(file):
|
||||||
file = str(file).replace("\\","/")
|
file = str(file).replace("\\","/")
|
||||||
|
2
setup.py
2
setup.py
@ -26,7 +26,7 @@ def get_all_files(path):
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lollms",
|
name="lollms",
|
||||||
version="5.7.3",
|
version="5.7.5",
|
||||||
author="Saifeddine ALOUI",
|
author="Saifeddine ALOUI",
|
||||||
author_email="aloui.saifeddine@gmail.com",
|
author_email="aloui.saifeddine@gmail.com",
|
||||||
description="A python library for AI personality definition",
|
description="A python library for AI personality definition",
|
||||||
|
Loading…
Reference in New Issue
Block a user