mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-02-20 17:33:03 +00:00
enhanced generation
This commit is contained in:
parent
bf49040182
commit
20ac66c5a6
@ -197,7 +197,8 @@ class LollmsSD:
|
||||
use_https=False,
|
||||
username=None,
|
||||
password=None,
|
||||
auto_sd_base_url=None
|
||||
auto_sd_base_url=None,
|
||||
share=False
|
||||
):
|
||||
if auto_sd_base_url=="" or auto_sd_base_url=="http://127.0.0.1:7860":
|
||||
auto_sd_base_url = None
|
||||
@ -239,14 +240,20 @@ class LollmsSD:
|
||||
if platform.system() == "Windows":
|
||||
ASCIIColors.info("Running on windows")
|
||||
script_path = self.sd_folder / "lollms_sd.bat"
|
||||
subprocess.Popen(script_path, cwd=self.sd_folder)
|
||||
if share:
|
||||
subprocess.Popen(script_path+" --share", cwd=self.sd_folder)
|
||||
else:
|
||||
subprocess.Popen(script_path, cwd=self.sd_folder)
|
||||
else:
|
||||
ASCIIColors.info("Running on linux/MacOs")
|
||||
script_path = str(self.sd_folder / "lollms_sd.sh")
|
||||
ASCIIColors.info(f"launcher path: {script_path}")
|
||||
ASCIIColors.info(f"sd path: {self.sd_folder}")
|
||||
|
||||
subprocess.Popen(['bash', script_path], cwd=self.sd_folder)
|
||||
if share:
|
||||
subprocess.Popen(['bash', script_path,"--share"], cwd=self.sd_folder)
|
||||
else:
|
||||
subprocess.Popen(['bash', script_path], cwd=self.sd_folder)
|
||||
ASCIIColors.info("Process done")
|
||||
ASCIIColors.success("Launching Auto1111's SD succeeded")
|
||||
|
||||
|
@ -170,7 +170,7 @@ Date: {{date}}
|
||||
self.load_personality()
|
||||
|
||||
|
||||
def fast_gen(self, prompt: str, max_generation_size: int=None, placeholders: dict = {}, sacrifice: list = ["previous_discussion"], debug: bool = False) -> str:
|
||||
def fast_gen(self, prompt: str, max_generation_size: int=None, placeholders: dict = {}, sacrifice: list = ["previous_discussion"], debug: bool = False, callback=None) -> str:
|
||||
"""
|
||||
Fast way to generate code
|
||||
|
||||
@ -201,7 +201,7 @@ Date: {{date}}
|
||||
if debug:
|
||||
self.print_prompt("prompt", prompt)
|
||||
|
||||
return self.generate(prompt, max_generation_size).strip().replace("</s>", "").replace("<s>", "")
|
||||
return self.generate(prompt, max_generation_size, callback=callback).strip().replace("</s>", "").replace("<s>", "")
|
||||
|
||||
def remove_text_from_string(self, string, text_to_find):
|
||||
"""
|
||||
@ -1698,7 +1698,7 @@ Yes or No?
|
||||
ASCIIColors.yellow(prompt)
|
||||
ASCIIColors.red(" *-*-*-*-*-*-*-*")
|
||||
|
||||
def fast_gen(self, prompt: str, max_generation_size: int= None, placeholders: dict = {}, sacrifice: list = ["previous_discussion"], debug: bool = False) -> str:
|
||||
def fast_gen(self, prompt: str, max_generation_size: int= None, placeholders: dict = {}, sacrifice: list = ["previous_discussion"], debug: bool = False, callback=None) -> str:
|
||||
"""
|
||||
Fast way to generate code
|
||||
|
||||
@ -1715,7 +1715,7 @@ Yes or No?
|
||||
Returns:
|
||||
- str: The generated text after removing special tokens ("<s>" and "</s>") and stripping any leading/trailing whitespace.
|
||||
"""
|
||||
return self.personality.fast_gen(prompt=prompt,max_generation_size=max_generation_size,placeholders=placeholders, sacrifice=sacrifice, debug=debug)
|
||||
return self.personality.fast_gen(prompt=prompt,max_generation_size=max_generation_size,placeholders=placeholders, sacrifice=sacrifice, debug=debug, callback=callback)
|
||||
|
||||
|
||||
#Helper method to convert outputs path to url
|
||||
|
Loading…
x
Reference in New Issue
Block a user