matthiastl's picture
TYGER for iPhone (Core ML, Neural Engine)
d65bf0f
Raw History Blame Contribute Delete
1.2 kB
#ifndef TYGER_COREML_BENCH_H
#define TYGER_COREML_BENCH_H
#define TYGER_HOP_N 5120 /* samples per 320 ms hop at 16 kHz */
#define TYGER_HOP_FRAMES 4 /* turn-taker frames per hop */
#define TYGER_OUTPUTS 8 /* 4 state logits, hazard, barge-in, backchannel, endpoint */
/// As TygerPhone's tyger_run, with the encoder in Core ML (16-bit floats, fixed 801 log-mel frames, CPU and Neural
/// Engine) and the turn-taker in ONNX Runtime on `threads` CPU threads. `load_ms` is Core ML's load alone.
const char *tyger_run(const char *l15_path, const char *gru_path, const float *mel_filters, const float *user,
const float *agent, int audio_hops, int hops, int threads, int previous_state, int paced,
float *hop_ms, float *delay_ms, float *encode_ms, float *outputs, double *load_ms);
/// Core ML's plan for the model: how many operations it would run on the Neural Engine, the GPU and the CPU.
/// Returns 0 if it doesn't say.
int tyger_plan(const char *l15_path, int *neural_engine, int *gpu, int *cpu);
/// Physical memory footprint of the app now, and its peak so far, in MB.
void tyger_memory(double *now_mb, double *peak_mb);
#endif