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

Method run

src/models/heartmula/codec.cpp:1123–1144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1121 }
1122
1123 HeartCodecConditioning run(const std::vector<int32_t> & codes) {
1124 allocate_workspace();
1125 const auto & config = runtime_->assets().codec_config;
1126 const size_t expected_codes = static_cast<size_t>(batch_size_ * config.num_quantizers * code_frames_);
1127 if (codes.size() != expected_codes) {
1128 throw std::runtime_error("HeartCodec conditioning code payload size mismatch");
1129 }
1130 ggml_backend_tensor_set(input_, codes.data(), 0, codes.size() * sizeof(int32_t));
1131 core::set_backend_threads(runtime_->backend(), runtime_->threads());
1132 const ggml_status status = core::compute_backend_graph(runtime_->backend(), graph_);
1133 ggml_backend_synchronize(runtime_->backend());
1134 if (status != GGML_STATUS_SUCCESS) {
1135 throw std::runtime_error("HeartCodec conditioning graph compute failed");
1136 }
1137 HeartCodecConditioning out;
1138 out.batch_size = batch_size_;
1139 out.frames = output_frames_;
1140 out.channels = config.dim;
1141 out.values.resize(static_cast<size_t>(out.batch_size * out.frames * out.channels));
1142 ggml_backend_tensor_get(output_, out.values.data(), 0, out.values.size() * sizeof(float));
1143 return out;
1144 }
1145
1146private:
1147 void allocate_workspace() {

Callers 3

estimate_flowMethod · 0.45
decode_scalar_latentsMethod · 0.45
build_conditioningMethod · 0.45

Calls 10

ggml_backend_tensor_setFunction · 0.85
set_backend_threadsFunction · 0.85
compute_backend_graphFunction · 0.85
ggml_backend_synchronizeFunction · 0.85
ggml_backend_tensor_getFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45
backendMethod · 0.45
threadsMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected