| 239 | out.blocks.push_back(item); |
| 240 | } |
| 241 | out.quantizer_project_in = engine::modules::LinearWeights{ |
| 242 | require_tensor(store, source, root + "quantizer.project_in.weight", storage_type), |
| 243 | require_tensor(store, source, root + "quantizer.project_in.bias", storage_type)}; |
| 244 | engine::core::validate_shape( |
| 245 | out.quantizer_project_in.weight, |
| 246 | engine::core::TensorShape::from_dims({code_dim, channels}), |
| 247 | "Seed-VC ASTRAL quantizer project_in weight"); |
| 248 | return out; |
| 249 | } |
| 250 | |
| 251 | engine::core::TensorValue build_astral_projected( |
| 252 | engine::core::ModuleBuildContext & ctx, |
| 253 | const engine::core::TensorValue & hidden_btc, |
| 254 | const AstralWeights & weights, |
| 255 | int64_t input_channels, |
| 256 | int64_t channels, |
| 257 | int64_t intermediate_channels) { |
| 258 | auto x = transpose_bct_btc(ctx, hidden_btc); |
| 259 | x = engine::modules::Conv1dModule({input_channels, channels, 1, 1, 0, 1, true}) |
| 260 | .build(ctx, x, weights.input_projection); |
| 261 | for (const auto & block : weights.blocks) { |
| 262 | const auto residual = x; |
| 263 | x = engine::modules::DepthwiseConv1dModule({channels, 7, 1, 3, 1, true}) |
| 264 | .build(ctx, x, block.dwconv); |
| 265 | x = channel_layer_norm_bct(ctx, x, block.norm_weight, block.norm_bias, channels); |
| 266 | x = contiguous(ctx, transpose_bct_btc(ctx, x)); |
| 267 | x = engine::modules::LinearModule({channels, intermediate_channels, true}) |
| 268 | .build(ctx, x, block.pwconv1); |
| 269 | x = engine::modules::GeluModule({engine::modules::GeluApproximation::ExactErf}).build(ctx, x); |
| 270 | x = grn_btc(ctx, x, block.grn_gamma, block.grn_beta, intermediate_channels); |
| 271 | x = engine::modules::LinearModule({intermediate_channels, channels, true}) |
| 272 | .build(ctx, x, block.pwconv2); |
| 273 | x = transpose_bct_btc(ctx, x); |
| 274 | x = engine::core::wrap_tensor( |
| 275 | ggml_add(ctx.ggml, contiguous(ctx, x).tensor, contiguous(ctx, residual).tensor), |
no test coverage detected