| 874 | auto timestep_mod = modules::LinearModule({estimator_dim, 6 * estimator_dim, true, GGML_PREC_F32}) |
| 875 | .build(ctx, modules::SiluModule{}.build(ctx, embedded_timestep), weights.adaln_single.linear); |
| 876 | for (size_t index = 0; index < weights.transformer_blocks.size(); ++index) { |
| 877 | const auto & block = weights.transformer_blocks[index]; |
| 878 | s = flow_transformer_block(ctx, s, timestep_mod, positions, block, config.num_attention_heads, config.attention_head_dim); |
| 879 | } |
| 880 | s = final_layer_norm_modulation(ctx, s, embedded_timestep, weights.scale_shift_table, estimator_dim); |
| 881 | ggml_tensor * first_stage_state = s.tensor; |
| 882 | |
| 883 | auto x = modules::ConcatModule({2}).build(ctx, hidden_states, s); |
| 884 | x = project_layer(ctx, x, weights.connection_proj, config.in_channels + estimator_dim, estimator_dim_2); |
| 885 | auto embedded_timestep_2 = adaln_embedding(ctx, timesteps, freqs, weights.adaln_single_2, estimator_dim_2); |
| 886 | auto timestep_mod_2 = modules::LinearModule({estimator_dim_2, 6 * estimator_dim_2, true, GGML_PREC_F32}) |
| 887 | .build(ctx, modules::SiluModule{}.build(ctx, embedded_timestep_2), weights.adaln_single_2.linear); |
| 888 | for (size_t index = 0; index < weights.transformer_blocks_2.size(); ++index) { |
| 889 | const auto & block = weights.transformer_blocks_2[index]; |
| 890 | x = flow_transformer_block(ctx, x, timestep_mod_2, positions, block, config.num_attention_heads, config.attention_head_dim * 2); |
| 891 | } |
| 892 | x = final_layer_norm_modulation(ctx, x, embedded_timestep_2, weights.scale_shift_table_2, estimator_dim_2); |
| 893 | return {project_layer(ctx, x, weights.proj_out, estimator_dim_2, config.out_channels), first_stage_state}; |
| 894 | } |
| 895 | |
| 896 | } // namespace |
| 897 | |
| 898 | class HeartCodecFlowEstimatorGraph { |
| 899 | public: |
no test coverage detected