| 1575 | } |
| 1576 | |
| 1577 | std::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 | |
| 1605 | VibeVoiceDecoderCachedBatchStepGraph * VibeVoiceDecoderWeightsRuntime::find_cached_batch_graph( |
| 1606 | const VibeVoiceDecoderCachedState & state) const { |