| 594 | weights.mel_mlp_0.bias.has_value(), |
| 595 | GGML_PREC_F32, |
| 596 | }).build(build_ctx, x_input, weights.mel_mlp_0); |
| 597 | x = engine::modules::SiluModule{}.build(build_ctx, x); |
| 598 | x = engine::modules::LinearModule({ |
| 599 | config.hidden_size * 4, |
| 600 | config.hidden_size, |
| 601 | weights.mel_mlp_2.bias.has_value(), |
| 602 | GGML_PREC_F32, |
| 603 | }).build(build_ctx, x, weights.mel_mlp_2); |
| 604 | |
| 605 | auto diffusion_step = engine::modules::LinearModule({ |
| 606 | config.hidden_size, |
| 607 | config.hidden_size * 4, |
| 608 | weights.diff_step_mlp_0.bias.has_value(), |
| 609 | GGML_PREC_F32, |
| 610 | }).build(build_ctx, timestep_input, weights.diff_step_mlp_0); |
| 611 | diffusion_step = engine::modules::SiluModule{}.build(build_ctx, diffusion_step); |
| 612 | diffusion_step = engine::modules::LinearModule({ |
| 613 | config.hidden_size * 4, |
| 614 | config.hidden_size, |
| 615 | weights.diff_step_mlp_2.bias.has_value(), |
| 616 | GGML_PREC_F32, |
| 617 | }).build(build_ctx, diffusion_step, weights.diff_step_mlp_2); |
| 618 | |
| 619 | x = engine::modules::AddModule{}.build(build_ctx, x, cond_embedding); |
| 620 | for (const auto & layer : weights.layers) { |
| 621 | x = diff_llama_layer(build_ctx, x, diffusion_step, positions, layer, config); |
| 622 | } |
| 623 | x = adaptive_rms_norm(build_ctx, x, diffusion_step, weights.final_norm_to_weight, config); |
| 624 | x = engine::modules::LinearModule({ |
| 625 | config.hidden_size, |
| 626 | config.hidden_size * 4, |
| 627 | weights.mel_out_mlp_0.bias.has_value(), |
| 628 | GGML_PREC_F32, |
| 629 | }).build(build_ctx, x, weights.mel_out_mlp_0); |
| 630 | x = engine::modules::SiluModule{}.build(build_ctx, x); |
| 631 | x = engine::modules::LinearModule({ |
| 632 | config.hidden_size * 4, |
| 633 | config.mel_dim, |
| 634 | weights.mel_out_mlp_2.bias.has_value(), |
| 635 | GGML_PREC_F32, |
| 636 | }).build(build_ctx, x, weights.mel_out_mlp_2); |
| 637 | return engine::core::ensure_backend_addressable_layout(build_ctx, x); |
| 638 | } |
| 639 | |
| 640 | } // namespace |
| 641 | |
| 642 | struct Vevo2DiffLlamaConditionGraph { |
| 643 | Vevo2DiffLlamaConditionGraph( |
| 644 | ggml_backend_t backend, |
| 645 | engine::core::BackendType backend_type, |
| 646 | size_t graph_context_bytes, |
| 647 | const Vevo2FMConfig & config, |
| 648 | std::shared_ptr<const Vevo2DiffLlamaWeights> weights, |
| 649 | int64_t code_tokens) |
| 650 | : backend(backend), |
| 651 | weights(std::move(weights)), |
| 652 | code_tokens(code_tokens) { |
| 653 | if (backend == nullptr || this->weights == nullptr) { |
no test coverage detected