MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / prepare_conditioning_inputs

Method prepare_conditioning_inputs

src/models/chatterbox/t3_component.cpp:205–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205T3InferenceComponent::PreparedInput T3InferenceComponent::prepare_conditioning_inputs(const ConditioningInput & input) const {
206 const int64_t hidden_size = weights_->hidden_size;
207 const int64_t speaker_embed_size = weights_->speaker_embed_size;
208 const int64_t num_heads = weights_->perceiver_num_heads;
209 const int64_t query_tokens = weights_->perceiver_query_tokens;
210 const auto spkr_enc_weight = engine::assets::tensor_data_to_f32("cond_enc.spkr_enc.weight", weights_->spkr_enc_weight);
211 const auto spkr_enc_bias = engine::assets::tensor_data_to_f32("cond_enc.spkr_enc.bias", weights_->spkr_enc_bias);
212 const auto emotion_adv_weight = engine::assets::tensor_data_to_f32(
213 "cond_enc.emotion_adv_fc.weight",
214 weights_->emotion_adv_weight);
215 const auto perceiver_pre_attention_query = engine::assets::tensor_data_to_f32(
216 "cond_enc.perceiver.pre_attention_query",
217 weights_->perceiver_pre_attention_query);
218 const auto perceiver_norm_weight = engine::assets::tensor_data_to_f32(
219 "cond_enc.perceiver.attn.norm.weight",
220 weights_->perceiver_norm_weight);
221 const auto perceiver_norm_bias = engine::assets::tensor_data_to_f32(
222 "cond_enc.perceiver.attn.norm.bias",
223 weights_->perceiver_norm_bias);
224 const auto perceiver_to_q_weight = engine::assets::tensor_data_to_f32(
225 "cond_enc.perceiver.attn.to_q.weight",
226 weights_->perceiver_to_q_weight);
227 const auto perceiver_to_q_bias = engine::assets::tensor_data_to_f32(
228 "cond_enc.perceiver.attn.to_q.bias",
229 weights_->perceiver_to_q_bias);
230 const auto perceiver_to_k_weight = engine::assets::tensor_data_to_f32(
231 "cond_enc.perceiver.attn.to_k.weight",
232 weights_->perceiver_to_k_weight);
233 const auto perceiver_to_k_bias = engine::assets::tensor_data_to_f32(
234 "cond_enc.perceiver.attn.to_k.bias",
235 weights_->perceiver_to_k_bias);
236 const auto perceiver_to_v_weight = engine::assets::tensor_data_to_f32(
237 "cond_enc.perceiver.attn.to_v.weight",
238 weights_->perceiver_to_v_weight);
239 const auto perceiver_to_v_bias = engine::assets::tensor_data_to_f32(
240 "cond_enc.perceiver.attn.to_v.bias",
241 weights_->perceiver_to_v_bias);
242 const auto perceiver_proj_out_weight = engine::assets::tensor_data_to_f32(
243 "cond_enc.perceiver.attn.proj_out.weight",
244 weights_->perceiver_proj_out_weight);
245 const auto perceiver_proj_out_bias = engine::assets::tensor_data_to_f32(
246 "cond_enc.perceiver.attn.proj_out.bias",
247 weights_->perceiver_proj_out_bias);
248 const auto text_embedding_weight = engine::assets::tensor_data_to_f32("text_emb.weight", weights_->text_embedding_weight);
249 const auto speech_embedding_weight = engine::assets::tensor_data_to_f32("speech_emb.weight", weights_->speech_embedding_weight);
250 const auto text_position_weight = engine::assets::tensor_data_to_f32(
251 "text_pos_emb.emb.weight",
252 weights_->text_position_weight);
253 const auto speech_position_weight = engine::assets::tensor_data_to_f32(
254 "speech_pos_emb.emb.weight",
255 weights_->speech_position_weight);
256
257 const auto cond_prompt_emb = gather_rows(
258 speech_embedding_weight,
259 weights_->speech_vocab,
260 hidden_size,
261 input.cond_prompt_speech_tokens);
262 std::vector<int32_t> cond_prompt_positions;

Callers

nothing calls this directly

Calls 10

tensor_data_to_f32Function · 0.85
gather_rowsFunction · 0.85
copyFunction · 0.85
layer_norm_rowsFunction · 0.85
attention_qkv_batchedFunction · 0.85
linear_rowsFunction · 0.85
assignMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected