| 472 | } |
| 473 | |
| 474 | core::TensorValue build_feed_forward( |
| 475 | core::ModuleBuildContext & ctx, |
| 476 | const core::TensorValue & hidden_btc, |
| 477 | const WavlmEncoderWeights & weights, |
| 478 | int64_t layer_index) { |
| 479 | const auto & config = weights.config; |
| 480 | const std::string prefix = "encoder.layers." + std::to_string(layer_index); |
| 481 | auto x = LinearModule({config.hidden_size, config.intermediate_size, true, GGML_PREC_F32}) |
| 482 | .build(ctx, hidden_btc, linear_weights(weights, prefix + ".fc1")); |
| 483 | x = GeluModule({GeluApproximation::ExactErf}).build(ctx, x); |
| 484 | return LinearModule({config.intermediate_size, config.hidden_size, true, GGML_PREC_F32}) |
| 485 | .build(ctx, x, linear_weights(weights, prefix + ".fc2")); |
| 486 | } |
| 487 | |
| 488 | std::vector<core::TensorValue> build_wavlm_graph_layers( |
| 489 | core::ModuleBuildContext & ctx, |
no test coverage detected