| 178 | config.preprocess = parse_acoustic_preprocess_config(root.require("preprocess")); |
| 179 | const auto & vocos = root.require("model").require("vocos"); |
| 180 | config.input_channels = json::require_i64(vocos, "input_channels"); |
| 181 | config.dim = json::require_i64(vocos, "dim"); |
| 182 | config.intermediate_dim = json::require_i64(vocos, "intermediate_dim"); |
| 183 | config.num_layers = json::require_i64(vocos, "num_layers"); |
| 184 | config.n_fft = json::require_i64(vocos, "n_fft"); |
| 185 | config.hop_size = json::require_i64(vocos, "hop_size"); |
| 186 | config.padding = json::require_string(vocos, "padding"); |
| 187 | if (config.input_channels <= 0 || config.dim <= 0 || config.intermediate_dim <= 0 || |
| 188 | config.num_layers <= 0 || config.n_fft <= 0 || config.hop_size <= 0) { |
| 189 | throw std::runtime_error("Vevo2 vocoder config contains non-positive dimensions"); |
| 190 | } |
| 191 | if (config.input_channels != config.preprocess.num_mels) { |
| 192 | throw std::runtime_error("Vevo2 vocoder input channels do not match preprocess num_mels"); |
| 193 | } |
| 194 | return config; |
| 195 | } |
| 196 | |
| 197 | Vevo2Config parse_config(const assets::ResourceBundle & resources) { |
| 198 | Vevo2Config config; |
| 199 | config.ar = parse_ar_config(resources); |
| 200 | const auto coco_configs = parse_ar_coco_configs(resources); |
| 201 | config.prosody_tokenizer = coco_configs.first; |
| 202 | config.content_style_tokenizer = coco_configs.second; |
| 203 | config.fm = parse_fm_config(resources, "fm_config", false); |
| 204 | config.fm_text = parse_fm_config(resources, "fm_text_config", true); |
| 205 | config.vocoder = parse_vocoder_config(resources); |
| 206 | config.whisper = parse_whisper_config(resources.parse_json("whisper_config")); |
no test coverage detected