MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / Vevo2ContentStyleTokenizerRuntime

Method Vevo2ContentStyleTokenizerRuntime

src/models/vevo2/components.cpp:1185–1213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
1200Vevo2TokenSequence 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) {

Callers

nothing calls this directly

Calls 6

open_tensor_sourceFunction · 0.85
load_whisper_statsFunction · 0.85
backendMethod · 0.45
backend_typeMethod · 0.45
release_storageMethod · 0.45

Tested by

no test coverage detected