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

Function build_encoder_streaming

src/models/vibevoice/tokenizer_audio.cpp:790–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790core::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
814core::TensorValue build_decoder(
815 core::ModuleBuildContext & ctx,

Callers 1

Calls 4

sconv1d_streamingFunction · 0.85
channel_rms_normFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected