| 393 | } |
| 394 | |
| 395 | std::vector<VibeVoiceConnectorOutput> VibeVoiceConnectorWeightsRuntime::project_semantic_batch( |
| 396 | const std::vector<VibeVoiceTokenizerLatents> & features) const { |
| 397 | if (features.empty()) { |
| 398 | throw std::runtime_error("VibeVoice semantic connector batch requires non-empty features"); |
| 399 | } |
| 400 | const int64_t frames = features.front().frames; |
| 401 | if (frames <= 0 || features.front().dim != weights_->semantic.input_dim) { |
| 402 | throw std::runtime_error("VibeVoice semantic connector batch received invalid feature shape"); |
| 403 | } |
| 404 | for (const auto & item : features) { |
| 405 | if (item.frames != frames || item.dim != weights_->semantic.input_dim) { |
| 406 | throw std::runtime_error("VibeVoice semantic connector batch requires uniform feature shape"); |
| 407 | } |
| 408 | } |
| 409 | const int64_t batch_size = static_cast<int64_t>(features.size()); |
| 410 | if (semantic_graph_ == nullptr || !semantic_graph_->matches(weights_->semantic, batch_size, frames)) { |
| 411 | semantic_graph_.reset(); |
| 412 | semantic_graph_ = std::make_unique<VibeVoiceConnectorGraph>( |
| 413 | *this, |
| 414 | weights_->semantic, |
| 415 | *semantic_constants_, |
| 416 | "vibevoice.connector.semantic", |
| 417 | batch_size, |
| 418 | frames, |
| 419 | 64ull * 1024ull * 1024ull); |
| 420 | } |
| 421 | auto out = semantic_graph_->run_batch(features); |
| 422 | return out; |
| 423 | } |
| 424 | |
| 425 | core::TensorValue build_vibevoice_connector( |
| 426 | core::ModuleBuildContext & ctx, |