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

Function build_coco_quantizer_ids

src/models/vevo2/components.cpp:898–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

896 return engine::core::reshape_tensor(
897 ctx,
898 ids,
899 engine::core::TensorShape::from_dims({1, projected_btd.shape.dims[1]}));
900}
901
902} // namespace
903
904struct Vevo2CocoTokenizerGraph {
905 Vevo2CocoTokenizerGraph(
906 ggml_backend_t backend,
907 engine::core::BackendType backend_type,
908 size_t graph_context_bytes,
909 const Vevo2CocoTokenizerConfig & config,
910 const Vevo2CocoTokenizerWeights & weights,
911 int64_t feature_frames)
912 : backend(backend),
913 uses_whisper(config.coco_type == "content_style"),
914 feature_frames(feature_frames),
915 output_frames(coco_output_frames(feature_frames, config.downsample_rate)) {
916 if (backend == nullptr) {
917 throw std::runtime_error("Vevo2 Coco tokenizer graph backend is not initialized");
918 }
919 if (feature_frames <= 0) {
920 throw std::runtime_error("Vevo2 Coco tokenizer graph requires positive feature frames");
921 }
922 if (uses_whisper && !weights.whisper_input.has_value()) {
923 throw std::runtime_error("Vevo2 content-style tokenizer graph requires Whisper input weights");
924 }
925 if (!weights.chromagram_input.has_value()) {
926 throw std::runtime_error("Vevo2 Coco tokenizer graph requires chromagram input weights");
927 }
928
929 ggml_init_params params{graph_context_bytes, nullptr, true};
930 ctx.reset(ggml_init(params));
931 if (ctx == nullptr) {
932 throw std::runtime_error("failed to initialize Vevo2 Coco tokenizer graph context");
933 }
934
935 engine::core::ModuleBuildContext build_ctx{ctx.get(), "vevo2.coco_tokenizer", backend_type};
936 chromagram_input = engine::core::make_tensor(

Callers 1

Calls 10

Conv1dModuleClass · 0.85
reshape_tensorFunction · 0.85
build_l2_normalized_rowsFunction · 0.85
LinearModuleClass · 0.85
wrap_tensorFunction · 0.85
ggml_argmaxFunction · 0.85
transpose_btc_to_bctFunction · 0.70
transpose_bct_to_btcFunction · 0.70
ensure_contiguousFunction · 0.70
buildMethod · 0.45

Tested by

no test coverage detected