#pragma once #include "engine/framework/core/attention_fallback.h" #include "engine/framework/core/execution_context.h" #include "engine/framework/assets/tensor_source.h" #include "engine/framework/runtime/session.h" #include "engine/models/breeze_tts/assets.h" #include "engine/models/breeze_tts/speech_decoder.h" #include #include #include namespace engine::core { class ConstantTensorCache; } namespace engine::models { namespace breeze_tts { struct BreezeSpeechEncoderWeights; class BreezeSpeechEncoderConvGraph; class BreezeSpeechEncoderTransformerGraph; struct BreezeSpeechEncoderOutput { BreezeSpeechCodes codes; std::vector semantic_projected; std::vector acoustic_projected; }; class BreezeSpeechEncoderRuntime { public: BreezeSpeechEncoderRuntime( std::shared_ptr assets, core::ExecutionContext & execution_context, size_t graph_arena_bytes, engine::assets::TensorStorageType linear_weight_storage_type, engine::assets::TensorStorageType conv_weight_storage_type, core::AttentionPreference attention_preference = core::AttentionPreference::Auto); ~BreezeSpeechEncoderRuntime(); BreezeSpeechCodes encode(const runtime::AudioBuffer & audio) const; void release_runtime_graphs() const; private: std::shared_ptr assets_; std::shared_ptr weights_; core::ExecutionContext * execution_context_ = nullptr; size_t graph_arena_bytes_ = 0; bool allow_flash_attention_ = true; std::unique_ptr constants_; mutable std::unique_ptr conv_graph_; mutable std::unique_ptr transformer_graph_; }; } // namespace breeze_tts } // namespace engine::models