#pragma once
#include "causal_lm/causal_lm.h"
#include "ggml-backend.h"
#include "ggml.h"
#include "transcribe-backend.h"
#include "transcribe-load-common.h"
#include "transcribe-mel.h"
#include "transcribe-model.h"
#include "transcribe-session.h"
#include "transcribe-tokenizer.h"
#include "weights.h"
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
struct ggml_context;
struct ggml_tensor;
struct ggml_backend;
struct ggml_backend_buffer;
struct ggml_backend_sched;
typedef struct ggml_backend * ggml_backend_t;
typedef struct ggml_backend_buffer * ggml_backend_buffer_t;
typedef struct ggml_backend_sched * ggml_backend_sched_t;
namespace transcribe::voxtral {
void apply_family_invariants(transcribe_model & model);
struct PromptSpecials {
int32_t bos = -1;
int32_t inst = -1; int32_t begin_audio = -1; int32_t end_inst = -1; int32_t transcribe = -1; int32_t eos = -1;
};
struct VoxtralModel final : public transcribe_model {
Tokenizer tok;
VoxtralHParams hparams;
VoxtralWeights weights;
ggml_context * ctx_meta = nullptr;
transcribe::BackendPlan plan;
transcribe::load_common::WeightStorage weight_storage;
transcribe::causal_lm::PackedGateUpHandles packed_gate_up;
std::optional<transcribe::MelFrontend> mel;
PromptSpecials specials;
VoxtralModel() = default;
~VoxtralModel() override;
const transcribe::Tokenizer * tokenizer() const override { return &tok; }
};
struct VoxtralSession final : public transcribe_session {
transcribe::causal_lm::KvCache kv_cache;
transcribe::causal_lm::KvCache kv_cache_batch;
int kv_batch_cap = 0; int kv_batch_n_ctx = 0;
std::vector<float> mel_buf;
std::vector<float> enc_host;
bool encoder_use_flash = false;
bool decoder_use_flash = true;
VoxtralSession() = default;
~VoxtralSession() override;
};
}