| 788 | } |
| 789 | |
| 790 | core::TensorValue build_encoder_streaming( |
| 791 | core::ModuleBuildContext & ctx, |
| 792 | const core::TensorValue & input, |
| 793 | const VibeVoiceTokenizerEncoderWeights & weights, |
| 794 | const VibeVoiceTokenizerConfig & config, |
| 795 | core::ConstantTensorCache & constants, |
| 796 | VibeVoiceStreamingBuildState & state) { |
| 797 | if (weights.downsample_layers.size() != weights.stages.size()) { |
| 798 | throw std::runtime_error("VibeVoice streaming tokenizer encoder layer/stage count mismatch"); |
| 799 | } |
| 800 | auto hidden = input; |
| 801 | for (size_t stage = 0; stage < weights.stages.size(); ++stage) { |
| 802 | const int64_t stride = stage == 0 ? 1 : config.encoder_ratios[config.encoder_ratios.size() - stage]; |
| 803 | hidden = sconv1d_streaming(ctx, hidden, weights.downsample_layers[stage], stride, state); |
| 804 | for (const auto & block : weights.stages[stage]) { |
| 805 | hidden = tokenizer_block_streaming(ctx, hidden, block, constants, state, config.layernorm_eps); |
| 806 | } |
| 807 | } |
| 808 | if (weights.norm.has_value()) { |
| 809 | hidden = channel_rms_norm(ctx, hidden, *weights.norm, constants, config.layernorm_eps); |
| 810 | } |
| 811 | return sconv1d_streaming(ctx, hidden, weights.head, 1, state); |
| 812 | } |
| 813 | |
| 814 | core::TensorValue build_decoder( |
| 815 | core::ModuleBuildContext & ctx, |
no test coverage detected