| 35 | const auto & encoder_strides = encoder_config.require("strides").as_array(); |
| 36 | if (encoder_strides.empty()) { |
| 37 | throw std::runtime_error("Stable Audio pretransform encoder strides must not be empty"); |
| 38 | } |
| 39 | config.pretransform_encoder_stride = encoder_strides.front().as_i64(); |
| 40 | config.same_encoder_in_channels = json::require_i64(encoder_config, "in_channels"); |
| 41 | config.same_decoder_out_channels = json::require_i64(decoder_config, "out_channels"); |
| 42 | config.same_channels = json::require_i64(encoder_config, "channels"); |
| 43 | if (config.same_channels != json::require_i64(decoder_config, "channels")) { |
| 44 | throw std::runtime_error("Stable Audio SAME encoder/decoder channel counts must match"); |
| 45 | } |
| 46 | config.same_dim_heads = json::optional_i64(encoder_config, "dim_heads", 64); |
| 47 | if (config.same_dim_heads != json::optional_i64(decoder_config, "dim_heads", config.same_dim_heads)) { |
| 48 | throw std::runtime_error("Stable Audio SAME encoder/decoder head dimensions must match"); |
| 49 | } |
| 50 | config.same_c_mults = json::require_i64_array(encoder_config, "c_mults"); |
| 51 | config.same_strides = json::require_i64_array(encoder_config, "strides"); |
| 52 | config.same_encoder_transformer_depths = json::require_i64_array(encoder_config, "transformer_depths"); |
no test coverage detected