| 1183 | int64_t feature_frames, |
| 1184 | bool uses_whisper) const { |
| 1185 | if (!uses_whisper) { |
| 1186 | throw std::runtime_error("Vevo2 content-style tokenizer graph requires Whisper features"); |
| 1187 | } |
| 1188 | if (graph_ == nullptr || !graph_->matches(feature_frames, true)) { |
| 1189 | graph_ = std::make_unique<Vevo2CocoTokenizerGraph>( |
| 1190 | execution_context_.backend(), |
| 1191 | execution_context_.backend_type(), |
| 1192 | graph_context_bytes_, |
| 1193 | config_, |
| 1194 | *weights_, |
| 1195 | feature_frames); |
| 1196 | } |
| 1197 | return *graph_; |
| 1198 | } |
| 1199 | |
| 1200 | Vevo2TokenSequence Vevo2ContentStyleTokenizerRuntime::encode_feature_frames( |
| 1201 | const std::vector<float> & whisper_features, |
| 1202 | const std::vector<float> & chromagram_features, |
| 1203 | int64_t feature_frames) const { |
| 1204 | if (static_cast<int64_t>(whisper_features.size()) != feature_frames * config_.whisper_dim) { |
| 1205 | throw std::runtime_error("Vevo2 content-style Whisper feature size mismatch"); |
| 1206 | } |
| 1207 | if (static_cast<int64_t>(chromagram_features.size()) != feature_frames * config_.chromagram_dim) { |
| 1208 | throw std::runtime_error("Vevo2 content-style chromagram feature size mismatch"); |
| 1209 | } |
| 1210 | std::vector<float> normalized_whisper = whisper_features; |
| 1211 | if (config_.use_normed_whisper) { |
| 1212 | if (static_cast<int64_t>(whisper_mean_.size()) != config_.whisper_dim || |
| 1213 | static_cast<int64_t>(whisper_std_.size()) != config_.whisper_dim) { |
| 1214 | throw std::runtime_error("Vevo2 content-style Whisper stats are not loaded"); |
| 1215 | } |
| 1216 | for (int64_t frame = 0; frame < feature_frames; ++frame) { |
nothing calls this directly
no test coverage detected