| 310 | } |
| 311 | |
| 312 | core::TensorValue swiglu_ff( |
| 313 | core::ModuleBuildContext & ctx, |
| 314 | const core::TensorValue & input, |
| 315 | const StableAudioRfFeedForwardWeights & weights, |
| 316 | const StableAudioConfig & config) { |
| 317 | auto projected = modules::LinearModule({config.embed_dim, 2 * ff_inner_dim(config), true, GGML_PREC_F32}) |
| 318 | .build(ctx, input, weights.in_proj); |
| 319 | auto value = modules::SliceModule({2, 0, ff_inner_dim(config)}).build(ctx, projected); |
| 320 | auto gate = modules::SliceModule({2, ff_inner_dim(config), ff_inner_dim(config)}).build(ctx, projected); |
| 321 | gate = modules::SiluModule{}.build(ctx, gate); |
| 322 | auto hidden = modules::MulModule{}.build(ctx, value, gate); |
| 323 | return modules::LinearModule({ff_inner_dim(config), config.embed_dim, true, GGML_PREC_F32}) |
| 324 | .build(ctx, hidden, weights.out_proj); |
| 325 | } |
| 326 | |
| 327 | core::TensorValue build_local_embedding( |
| 328 | core::ModuleBuildContext & ctx, |
no test coverage detected