</s> new line mode

Needed for Fairseq and XGLM models that do not understand the regular \n .
This commit is contained in:
henk717 2022-01-31 18:39:34 +01:00
parent 44d49ea732
commit 729be62821

View File

@ -201,6 +201,7 @@ class vars:
rngpersist = False rngpersist = False
nogenmod = False nogenmod = False
welcome = False # Custom Welcome Text (False is default) welcome = False # Custom Welcome Text (False is default)
newlinemode = "n"
#==================================================================# #==================================================================#
# Function to get model selection at startup # Function to get model selection at startup
@ -427,6 +428,8 @@ def loadmodelsettings():
vars.formatoptns = js["formatoptns"] vars.formatoptns = js["formatoptns"]
if("welcome" in js): if("welcome" in js):
vars.welcome = js["welcome"] vars.welcome = js["welcome"]
if("newlinemode" in js):
vars.newlinemode = js["newlinemode"]
if("antemplate" in js): if("antemplate" in js):
vars.setauthornotetemplate = js["antemplate"] vars.setauthornotetemplate = js["antemplate"]
if(not vars.gamestarted): if(not vars.gamestarted):
@ -2236,6 +2239,7 @@ def savesettings():
js["userscripts"] = vars.userscripts js["userscripts"] = vars.userscripts
js["corescript"] = vars.corescript js["corescript"] = vars.corescript
js["softprompt"] = vars.spfilename js["softprompt"] = vars.spfilename
js["newlinemode"] = vars.newlinemode
# Write it # Write it
if not os.path.exists('settings'): if not os.path.exists('settings'):
@ -2304,6 +2308,8 @@ def loadsettings():
vars.nogenmod = js["nogenmod"] vars.nogenmod = js["nogenmod"]
if("autosave" in js): if("autosave" in js):
vars.autosave = js["autosave"] vars.autosave = js["autosave"]
if("newlinemode" in js):
vars.newlinemode = js["newlinemode"]
if("antemplate" in js): if("antemplate" in js):
vars.setauthornotetemplate = js["antemplate"] vars.setauthornotetemplate = js["antemplate"]
@ -2369,6 +2375,12 @@ def actionsubmit(data, actionmode=0, force_submit=False, force_prompt_gen=False,
if(vars.aibusy): if(vars.aibusy):
return return
# </s> mode
if(vars.newlinemode == "s"):
print("S mode activated")
data = data.replace('\n', "</s>")
print(data)
while(True): while(True):
set_aibusy(1) set_aibusy(1)