#pragma once #include "engine/framework/core/backend_weight_store.h" #include "engine/framework/modules/feed_forward_modules.h" #include "engine/framework/modules/attention/types.h" #include "engine/framework/modules/conv_modules.h" #include "engine/framework/modules/linear_module.h" #include "engine/framework/modules/norm_modules.h" #include "engine/models/moonshine_asr/assets.h" #include #include #include namespace engine::models::moonshine_asr { struct MoonshineFrontendWeights { float log_k = 0.0F; engine::modules::LinearWeights linear; engine::modules::Conv1dWeights conv1; engine::modules::Conv1dWeights conv2; }; struct MoonshineEncoderLayerWeights { engine::modules::NormWeights input_norm; engine::modules::AttentionWeights self_attn; engine::modules::NormWeights post_attention_norm; engine::modules::FeedForwardWeights feed_forward; }; struct MoonshineEncoderWeights { MoonshineFrontendWeights frontend; std::vector layers; engine::modules::NormWeights final_norm; }; struct MoonshineDecoderLayerWeights { engine::modules::NormWeights input_norm; engine::modules::AttentionWeights self_attn; engine::modules::NormWeights post_attention_norm; engine::modules::AttentionWeights cross_attn; engine::modules::NormWeights final_norm; engine::modules::LinearWeights mlp_fc1; engine::modules::LinearWeights mlp_fc2; }; struct MoonshineDecoderWeights { engine::core::TensorValue token_embedding; engine::core::TensorValue position_embedding; std::optional adapter_proj; std::vector layers; engine::modules::NormWeights norm; engine::modules::LinearWeights output_projection; }; struct MoonshineWeights { std::shared_ptr store; MoonshineEncoderWeights encoder; MoonshineDecoderWeights decoder; }; std::shared_ptr load_moonshine_asr_weights( const MoonshineAssets & assets, ggml_backend_t backend, engine::core::BackendType backend_type, engine::assets::TensorStorageType encoder_storage_type, engine::assets::TensorStorageType decoder_storage_type, engine::assets::TensorStorageType conv_storage_type, size_t weight_context_bytes, bool include_decoder = true); } // namespace engine::models::moonshine_asr