Optimize prompt TTFA

This commit is contained in:
Andres Marafioti
2026-05-30 15:41:29 +02:00
parent b7d601ff66
commit a0f504ce4c
3 changed files with 274 additions and 99 deletions
+29
View File
@@ -70,6 +70,34 @@ struct GenerationDefaults {
int max_new_tokens;
};
struct PromptTextProjection {
int in_dim;
int hid_dim;
int out_dim;
std::vector<float> fc1_w;
std::vector<float> fc1_b;
std::vector<float> fc2_w;
std::vector<float> fc2_b;
};
struct PromptPrefixCacheEntry {
std::string key;
int rows;
std::vector<float> input_embed_prefix;
};
struct PromptCache {
bool initialized;
PromptTextProjection text_projection;
std::vector<float> tts_bos_emb;
std::vector<float> tts_eos_emb;
std::vector<float> tts_pad_emb;
std::vector<float> codec_pad_emb;
std::vector<float> codec_bos_emb;
std::vector<PromptPrefixCacheEntry> prefix_entries;
size_t max_prefix_entries;
};
struct PipelineTTS {
GGUFModel gguf_talker;
TalkerWeights talker;
@@ -89,6 +117,7 @@ struct PipelineTTS {
std::vector<LanguageEntry> languages;
std::vector<SpeakerEntry> speakers;
GenerationDefaults gen_defaults;
PromptCache prompt_cache;
BackendPair bp;
ggml_backend_t backend;