| 459 | } |
| 460 | |
| 461 | MioCodecUpsamplerWeights bind_upsampler( |
| 462 | MioCodecWeights & weights, |
| 463 | const engine::assets::TensorSource & source, |
| 464 | engine::assets::TensorStorageType storage_type) { |
| 465 | MioCodecUpsamplerWeights upsampler; |
| 466 | const int64_t factors[] = {3, 3}; |
| 467 | const int64_t kernels[] = {9, 9}; |
| 468 | int64_t in_channels = 512; |
| 469 | upsampler.stages.reserve(2); |
| 470 | for (int64_t stage = 0; stage < 2; ++stage) { |
| 471 | const int64_t out_channels = in_channels / 2; |
| 472 | const std::string stage_index = std::to_string(stage); |
| 473 | MioCodecUpsamplerStageWeights item; |
| 474 | item.upsample = bind_weight_norm_conv_transpose1d( |
| 475 | weights, |
| 476 | source, |
| 477 | "wave_upsampler.upsample_layers." + stage_index, |
| 478 | in_channels, |
| 479 | out_channels, |
| 480 | kernels[stage], |
| 481 | static_cast<int>(factors[stage]), |
| 482 | static_cast<int>((kernels[stage] - factors[stage]) / 2), |
| 483 | storage_type); |
| 484 | item.snake = bind_snake_beta(weights, source, "wave_upsampler.snake_activations." + stage_index, out_channels); |
| 485 | item.resnet = bind_resnet_block(weights, "wave_upsampler.resnet_blocks." + stage_index, out_channels); |
| 486 | upsampler.stages.push_back(std::move(item)); |
| 487 | in_channels = out_channels; |
| 488 | } |
| 489 | upsampler.output_projection = bind_linear(weights, "wave_upsampler.out_proj", 128, 512); |
| 490 | upsampler.output_snake = bind_snake_beta(weights, source, "wave_upsampler.out_snake", 512); |
| 491 | return upsampler; |
| 492 | } |
| 493 | |
| 494 | MioCodecGlobalEncoderWeights bind_global_encoder(const MioCodecWeights & weights) { |
| 495 | MioCodecGlobalEncoderWeights global; |
no test coverage detected