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

Function load_coco_tokenizer_weights

src/models/vevo2/components.cpp:752–810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

750 matmul_storage_type,
751 config.hidden_size,
752 config.chromagram_dim,
753 true);
754 int64_t downsample_rate = config.downsample_rate;
755 while (downsample_rate > 1 && downsample_rate % 2 == 0) {
756 const int64_t layer = static_cast<int64_t>(weights->downsample_layers.size());
757 weights->downsample_layers.push_back(engine::modules::binding::conv1d_from_source(
758 *weights->store,
759 source,
760 "downsample_layers." + std::to_string(layer * 2),
761 conv_storage_type,
762 config.hidden_size,
763 config.hidden_size,
764 3,
765 true));
766 downsample_rate /= 2;
767 }
768 if (downsample_rate != 1) {
769 throw std::runtime_error("Vevo2 Coco downsample_rate must be a positive power of two");
770 }
771 weights->encoder = load_coco_vocos_encoder_weights(
772 *weights->store,
773 source,
774 config,
775 matmul_storage_type,
776 conv_storage_type);
777 weights->quantizer = load_coco_fvq_weights(*weights->store, source, config, conv_storage_type);
778 weights->store->upload();
779 return weights;
780}
781
782engine::core::TensorValue build_coco_convnext_block(
783 engine::core::ModuleBuildContext & ctx,
784 const engine::core::TensorValue & input_bct,
785 const Vevo2CocoConvNeXtBlockWeights & weights,
786 const Vevo2CocoTokenizerConfig & config) {
787 auto hidden = engine::modules::DepthwiseConv1dModule({
788 config.vocos_dim,
789 7,
790 1,
791 3,
792 1,
793 weights.dwconv.bias.has_value(),
794 }).build(ctx, input_bct, weights.dwconv);
795 hidden = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, hidden);
796 hidden = engine::modules::LayerNormModule({config.vocos_dim, 1.0e-6F, true, true})
797 .build(ctx, hidden, weights.norm);
798 hidden = engine::modules::LinearModule({
799 config.vocos_dim,
800 config.vocos_intermediate_dim,
801 true,
802 GGML_PREC_F32,
803 }).build(ctx, hidden, weights.pwconv1);
804 hidden = engine::modules::GeluModule({engine::modules::GeluApproximation::ExactErf}).build(ctx, hidden);
805 hidden = engine::modules::LinearModule({
806 config.vocos_intermediate_dim,
807 config.vocos_dim,
808 true,
809 GGML_PREC_F32,

Calls 8

linear_from_sourceFunction · 0.85
conv1d_from_sourceFunction · 0.85
load_coco_fvq_weightsFunction · 0.85
uploadMethod · 0.80
stringFunction · 0.50
to_stringFunction · 0.50

Tested by

no test coverage detected