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

Function build_vibevoice_diffusion_head

src/models/vibevoice/diffusion_head.cpp:495–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493}
494
495core::TensorValue build_vibevoice_diffusion_head(
496 core::ModuleBuildContext & ctx,
497 const core::TensorValue & noisy_images,
498 const core::TensorValue & timesteps,
499 const core::TensorValue & condition,
500 const VibeVoiceDiffusionHeadWeights & weights,
501 const VibeVoiceDiffusionHeadConfig & config,
502 core::ConstantTensorCache & constants) {
503 validate_config(config);
504 core::validate_shape(noisy_images, core::TensorShape::from_dims({noisy_images.shape.dims[0], config.latent_size}), "noisy_images");
505 core::validate_shape(condition, core::TensorShape::from_dims({noisy_images.shape.dims[0], config.hidden_size}), "condition");
506 core::validate_shape(timesteps, core::TensorShape::from_dims({noisy_images.shape.dims[0]}), "timesteps");
507 if (static_cast<int64_t>(weights.layers.size()) != config.head_layers) {
508 throw std::runtime_error("VibeVoice diffusion head layer count mismatch");
509 }
510
511 auto x = modules::LinearModule(
512 binding::linear_config(config.latent_size, config.hidden_size, false))
513 .build(ctx, noisy_images, weights.noisy_images_proj);
514 auto time_embedding = build_timestep_embedding(ctx, timesteps, weights, config);
515 auto projected_condition = modules::LinearModule(
516 binding::linear_config(config.hidden_size, config.hidden_size, false))
517 .build(ctx, condition, weights.cond_proj);
518 auto c = add_tensors(ctx, projected_condition, time_embedding);
519 for (const auto & layer : weights.layers) {
520 x = build_head_layer(ctx, x, c, layer, config, weights.ones, constants);
521 }
522 return build_final_layer(ctx, x, c, weights, config);
523}
524
525} // namespace engine::models::vibevoice

Callers 1

Calls 10

validate_shapeFunction · 0.85
LinearModuleClass · 0.85
linear_configFunction · 0.85
build_head_layerFunction · 0.85
build_final_layerFunction · 0.85
validate_configFunction · 0.70
build_timestep_embeddingFunction · 0.70
add_tensorsFunction · 0.70
sizeMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected