#pragma once
#include "../whisper/weights.h"
#include "transcribe-backend.h"
#include "transcribe-load-common.h"
#include "transcribe-mel.h"
#include "transcribe-model.h"
#include "transcribe-turn.h"
#include <cstdint>
#include <optional>
#include <vector>
struct ggml_context;
struct ggml_tensor;
namespace transcribe {
struct Arch;
}
namespace transcribe::smart_turn {
struct HParams {
whisper::WhisperHParams whisper;
int32_t max_audio_samples = 0; float threshold = 0.5f; bool waveform_normalize = true; float waveform_normalize_eps = 1e-7f;
int32_t pool_hidden = 0; int32_t cls_hidden0 = 0; int32_t cls_hidden1 = 0; float cls_norm_eps = 1e-5f;
int32_t n_mel_frames() const { return max_audio_samples / whisper.fe_hop_length; }
};
struct HeadWeights {
ggml_tensor * pool0_w = nullptr; ggml_tensor * pool0_b = nullptr; ggml_tensor * pool2_w = nullptr; ggml_tensor * pool2_b = nullptr; ggml_tensor * cls0_w = nullptr; ggml_tensor * cls0_b = nullptr;
ggml_tensor * cls1_w = nullptr; ggml_tensor * cls1_b = nullptr;
ggml_tensor * cls4_w = nullptr; ggml_tensor * cls4_b = nullptr;
ggml_tensor * cls6_w = nullptr; ggml_tensor * cls6_b = nullptr; };
struct Model final : public transcribe_model {
HParams hparams;
whisper::WhisperWeights encoder; HeadWeights head;
TurnModelInfo turn_info;
ggml_context * ctx_meta = nullptr;
load_common::WeightStorage weight_storage;
BackendPlan plan;
std::optional<MelFrontend> mel;
bool use_flash = false;
Model() = default;
~Model() override;
};
struct Session final : public transcribe_turn_session {
std::vector<float> window; std::vector<float> mel_raw; std::vector<float> mel_in; };
extern const Arch arch;
}