| 810 | }).build(ctx, hidden, weights.pwconv2); |
| 811 | hidden = scale_last_dim(ctx, hidden, weights.gamma); |
| 812 | hidden = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, hidden); |
| 813 | return engine::modules::AddModule{}.build(ctx, input_bct, hidden); |
| 814 | } |
| 815 | |
| 816 | engine::core::TensorValue build_coco_vocos_encoder( |
| 817 | engine::core::ModuleBuildContext & ctx, |
| 818 | const engine::core::TensorValue & input_bct, |
| 819 | const Vevo2CocoTokenizerWeights & weights, |
| 820 | const Vevo2CocoTokenizerConfig & config) { |
| 821 | auto hidden = engine::modules::Conv1dModule({ |
| 822 | config.hidden_size, |
| 823 | config.vocos_dim, |
| 824 | 7, |
| 825 | 1, |
| 826 | 3, |
| 827 | 1, |
| 828 | weights.encoder.embed.bias.has_value(), |
| 829 | }).build(ctx, input_bct, weights.encoder.embed); |
| 830 | hidden = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, hidden); |
| 831 | hidden = engine::modules::LayerNormModule({config.vocos_dim, 1.0e-6F, true, true}) |
| 832 | .build(ctx, hidden, weights.encoder.norm); |
| 833 | hidden = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, hidden); |
| 834 | for (const auto & block : weights.encoder.convnext) { |
| 835 | hidden = build_coco_convnext_block(ctx, hidden, block, config); |
| 836 | } |
| 837 | hidden = engine::modules::TransposeModule({{0, 2, 1, 3}, 3}).build(ctx, hidden); |
| 838 | hidden = engine::modules::LayerNormModule({config.vocos_dim, 1.0e-6F, true, true}) |
| 839 | .build(ctx, hidden, weights.encoder.final_norm); |
| 840 | return engine::modules::LinearModule({ |
| 841 | config.vocos_dim, |
| 842 | config.hidden_size, |
| 843 | true, |
| 844 | GGML_PREC_F32, |
| 845 | }).build(ctx, hidden, weights.encoder.output); |
| 846 | } |
| 847 |
no test coverage detected