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

Method prefill_embeddings_batch

src/models/vibevoice/decoder.cpp:1577–1603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1575}
1576
1577std::vector<VibeVoiceDecoderPrefillOutput> VibeVoiceDecoderWeightsRuntime::prefill_embeddings_batch(
1578 const std::vector<std::vector<float>> & embeddings,
1579 int64_t steps) const {
1580 const auto & config = assets_->config.decoder;
1581 if (embeddings.empty()) {
1582 throw std::runtime_error("VibeVoice decoder batch prefill requires at least one sample");
1583 }
1584 if (steps <= 0) {
1585 throw std::runtime_error("VibeVoice decoder batch prefill requires positive steps");
1586 }
1587 const size_t expected_size = static_cast<size_t>(steps * config.hidden_size);
1588 for (const auto & sample : embeddings) {
1589 if (sample.size() != expected_size) {
1590 throw std::runtime_error("VibeVoice decoder batch prefill embedding payload size mismatch");
1591 }
1592 }
1593 const int64_t batch_size = static_cast<int64_t>(embeddings.size());
1594 if (prefill_graph_ == nullptr || !prefill_graph_->matches(*this, batch_size, steps)) {
1595 prefill_graph_.reset();
1596 prefill_graph_ = std::make_unique<VibeVoiceDecoderPrefillGraph>(
1597 *this,
1598 batch_size,
1599 steps,
1600 1024ull * 1024ull * 1024ull);
1601 }
1602 return prefill_graph_->run_batch(embeddings);
1603}
1604
1605VibeVoiceDecoderCachedBatchStepGraph * VibeVoiceDecoderWeightsRuntime::find_cached_batch_graph(
1606 const VibeVoiceDecoderCachedState & state) const {

Callers 1

generate_vibevoice_batchFunction · 0.80

Calls 5

emptyMethod · 0.45
sizeMethod · 0.45
matchesMethod · 0.45
resetMethod · 0.45
run_batchMethod · 0.45

Tested by

no test coverage detected