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

Method run

src/models/vibevoice/diffusion_head.cpp:289–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 }
288
289 VibeVoiceDiffusionPrediction run(
290 const std::vector<float> & noisy_images,
291 int64_t latent_size,
292 float timestep,
293 const std::vector<float> & condition,
294 int64_t condition_hidden_size) {
295 const auto & config = runtime_->assets().config.diffusion_head;
296 if (latent_size != config.latent_size || condition_hidden_size != config.hidden_size) {
297 throw std::runtime_error("VibeVoice diffusion head input dimension mismatch");
298 }
299 if (static_cast<int64_t>(noisy_images.size()) != frames_ * config.latent_size) {
300 throw std::runtime_error("VibeVoice diffusion head noisy latent payload size mismatch");
301 }
302 if (static_cast<int64_t>(condition.size()) != frames_ * config.hidden_size) {
303 throw std::runtime_error("VibeVoice diffusion head condition payload size mismatch");
304 }
305 ggml_backend_tensor_set(noisy_, noisy_images.data(), 0, noisy_images.size() * sizeof(float));
306 std::vector<float> timestep_values(static_cast<size_t>(frames_), timestep);
307 ggml_backend_tensor_set(timesteps_, timestep_values.data(), 0, timestep_values.size() * sizeof(float));
308 ggml_backend_tensor_set(condition_, condition.data(), 0, condition.size() * sizeof(float));
309 core::set_backend_threads(runtime_->backend(), runtime_->threads());
310 const ggml_status status = engine::core::compute_backend_graph(runtime_->backend(), graph_);
311 ggml_backend_synchronize(runtime_->backend());
312 if (status != GGML_STATUS_SUCCESS) {
313 throw std::runtime_error("VibeVoice diffusion head graph compute failed");
314 }
315 VibeVoiceDiffusionPrediction out;
316 out.frames = frames_;
317 out.latent_size = config.latent_size;
318 out.values.resize(static_cast<size_t>(frames_ * config.latent_size));
319 ggml_backend_tensor_get(output_, out.values.data(), 0, out.values.size() * sizeof(float));
320 return out;
321 }
322
323private:
324 const VibeVoiceDiffusionHeadWeightsRuntime * runtime_ = nullptr;

Callers 1

predictMethod · 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