Load soft prompt at the end instead of inside `loadsettings()`
This commit is contained in:
parent
8120e4dfa2
commit
072ca87977
15
aiserver.py
15
aiserver.py
|
@ -599,11 +599,6 @@ def loadsettings():
|
||||||
else:
|
else:
|
||||||
vars.corescript = "default.lua"
|
vars.corescript = "default.lua"
|
||||||
|
|
||||||
if(vars.allowsp and "softprompt" in js and type(js["softprompt"]) is str and all(q not in js["softprompt"] for q in ("..", ":")) and (len(js["softprompt"]) == 0 or all(js["softprompt"][0] not in q for q in ("/", "\\")))):
|
|
||||||
spRequest(js["softprompt"])
|
|
||||||
else:
|
|
||||||
vars.spfilename = ""
|
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
#==================================================================#
|
#==================================================================#
|
||||||
|
@ -4899,6 +4894,16 @@ def __preempt_tokenizer():
|
||||||
tokenizer.encode(utils.encodenewlines("eunoia"))
|
tokenizer.encode(utils.encodenewlines("eunoia"))
|
||||||
threading.Thread(target=__preempt_tokenizer).start()
|
threading.Thread(target=__preempt_tokenizer).start()
|
||||||
|
|
||||||
|
# Load soft prompt specified by the settings file, if applicable
|
||||||
|
if(path.exists("settings/" + getmodelname().replace('/', '_') + ".settings")):
|
||||||
|
file = open("settings/" + getmodelname().replace('/', '_') + ".settings", "r")
|
||||||
|
js = json.load(file)
|
||||||
|
if(vars.allowsp and "softprompt" in js and type(js["softprompt"]) is str and all(q not in js["softprompt"] for q in ("..", ":")) and (len(js["softprompt"]) == 0 or all(js["softprompt"][0] not in q for q in ("/", "\\")))):
|
||||||
|
spRequest(js["softprompt"])
|
||||||
|
else:
|
||||||
|
vars.spfilename = ""
|
||||||
|
file.close()
|
||||||
|
|
||||||
# Precompile TPU backend if required
|
# Precompile TPU backend if required
|
||||||
if(vars.model in ("TPUMeshTransformerGPTJ",)):
|
if(vars.model in ("TPUMeshTransformerGPTJ",)):
|
||||||
soft_tokens = tpumtjgetsofttokens()
|
soft_tokens = tpumtjgetsofttokens()
|
||||||
|
|
Loading…
Reference in New Issue