mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-11 01:24:36 +00:00
remove tts audio caching
This commit is contained in:
parent
b162c25a5e
commit
71016db617
4 changed files with 3 additions and 20 deletions
1
expose.h
1
expose.h
|
@ -224,7 +224,6 @@ struct tts_generation_inputs
|
||||||
const char * prompt = nullptr;
|
const char * prompt = nullptr;
|
||||||
const int speaker_seed = 0;
|
const int speaker_seed = 0;
|
||||||
const int audio_seed = 0;
|
const int audio_seed = 0;
|
||||||
const bool nocache = false;
|
|
||||||
};
|
};
|
||||||
struct tts_generation_outputs
|
struct tts_generation_outputs
|
||||||
{
|
{
|
||||||
|
|
|
@ -5298,6 +5298,8 @@ Current version indicated by LITEVER below.
|
||||||
.replace(/<\/ul>\n<ul>/g, "")
|
.replace(/<\/ul>\n<ul>/g, "")
|
||||||
.replace(/<\/li><\/ul>\n\s*?\n<ul><li>/gm, "</li>\n<li>")
|
.replace(/<\/li><\/ul>\n\s*?\n<ul><li>/gm, "</li>\n<li>")
|
||||||
.replace(/<\/li><\/ul>\s*?<ul><li>/gm, "</li><li>")
|
.replace(/<\/li><\/ul>\s*?<ul><li>/gm, "</li><li>")
|
||||||
|
.replace(/<\/ul>\n/gm, "</ul>")
|
||||||
|
.replace(/<\/ol>\n/gm, "</ol>")
|
||||||
|
|
||||||
.replace(/\*\*\*([^\s*].*?[^\\])\*\*\*/gm, "<b><em>$1</em></b>")
|
.replace(/\*\*\*([^\s*].*?[^\\])\*\*\*/gm, "<b><em>$1</em></b>")
|
||||||
.replace(/\*\*([^\s*].*?[^\\])\*\*/gm, "<b>$1</b>")
|
.replace(/\*\*([^\s*].*?[^\\])\*\*/gm, "<b>$1</b>")
|
||||||
|
@ -12736,7 +12738,6 @@ Current version indicated by LITEVER below.
|
||||||
payload =
|
payload =
|
||||||
{
|
{
|
||||||
"input": text,
|
"input": text,
|
||||||
"nocache": true,
|
|
||||||
"voice": (document.getElementById("kcpp_tts_voice").value == "custom")?document.getElementById("kcpp_tts_voice_custom").value:document.getElementById("kcpp_tts_voice").value
|
"voice": (document.getElementById("kcpp_tts_voice").value == "custom")?document.getElementById("kcpp_tts_voice_custom").value:document.getElementById("kcpp_tts_voice").value
|
||||||
};
|
};
|
||||||
ttsheaders = get_kobold_header();
|
ttsheaders = get_kobold_header();
|
||||||
|
|
|
@ -304,8 +304,7 @@ class tts_load_model_inputs(ctypes.Structure):
|
||||||
class tts_generation_inputs(ctypes.Structure):
|
class tts_generation_inputs(ctypes.Structure):
|
||||||
_fields_ = [("prompt", ctypes.c_char_p),
|
_fields_ = [("prompt", ctypes.c_char_p),
|
||||||
("speaker_seed", ctypes.c_int),
|
("speaker_seed", ctypes.c_int),
|
||||||
("audio_seed", ctypes.c_int),
|
("audio_seed", ctypes.c_int)]
|
||||||
("nocache", ctypes.c_bool)]
|
|
||||||
|
|
||||||
class tts_generation_outputs(ctypes.Structure):
|
class tts_generation_outputs(ctypes.Structure):
|
||||||
_fields_ = [("status", ctypes.c_int),
|
_fields_ = [("status", ctypes.c_int),
|
||||||
|
@ -1491,7 +1490,6 @@ def tts_generate(genparams):
|
||||||
except Exception:
|
except Exception:
|
||||||
aseed = -1
|
aseed = -1
|
||||||
inputs.audio_seed = aseed
|
inputs.audio_seed = aseed
|
||||||
inputs.nocache = genparams.get("nocache", False)
|
|
||||||
ret = handle.tts_generate(inputs)
|
ret = handle.tts_generate(inputs)
|
||||||
outstr = ""
|
outstr = ""
|
||||||
if ret.status==1:
|
if ret.status==1:
|
||||||
|
|
|
@ -638,21 +638,6 @@ tts_generation_outputs ttstype_generate(const tts_generation_inputs inputs)
|
||||||
std::mt19937 tts_rng(audio_seed);
|
std::mt19937 tts_rng(audio_seed);
|
||||||
std::mt19937 speaker_rng(speaker_seed);
|
std::mt19937 speaker_rng(speaker_seed);
|
||||||
|
|
||||||
//if we can reuse an old generation, do so
|
|
||||||
if(!inputs.nocache
|
|
||||||
&& last_generation_settings_audio_seed == inputs.audio_seed
|
|
||||||
&& last_generation_settings_speaker_seed == inputs.speaker_seed
|
|
||||||
&& last_generated_audio!=""
|
|
||||||
&& last_generation_settings_prompt == std::string(inputs.prompt))
|
|
||||||
{
|
|
||||||
if (ttsdebugmode == 1 && !tts_is_quiet) {
|
|
||||||
printf("\nReusing Cached Audio.\n");
|
|
||||||
}
|
|
||||||
output.data = last_generated_audio.c_str();
|
|
||||||
output.status = 1;
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int n_decode = 0;
|
int n_decode = 0;
|
||||||
int n_predict = 2048; //will be updated later
|
int n_predict = 2048; //will be updated later
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue