yum-archive/TaSTT-Whisper
High-performance GPGPU inference of OpenAI's Whisper automatic speech recognition (ASR) model
git clone https://git.yummers.dev/yum-archive/TaSTT-Whisper
e1e3ac0
master
1#pragma once 2#include "iTranscribeResult.h" 3#include "SpecialTokens.h" 4#include "loggerApi.h" 5#include "sLanguageList.h" 6#include "sLoadModelCallbacks.h" 7#include "eGpuModelFlags.h" 8 9namespace Whisper 10{ 11__interface iModel ; 12__interface iAudioBuffer ; 13__interface iAudioReader ; 14__interface iAudioCapture ; 15struct sCaptureCallbacks ; 16struct sFullParams ; 17enum struct eModelImplementation :uint32_t ; 18enum struct eSamplingStrategy :int ; 19using whisper_token = int ; 20struct sProgressSink ; 21 22__interface __declspec(novtable ,uuid ("b9956374-3b18-4943-90f2-2ab18a404537" ) )iContext :public IUnknown 23 { 24// Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text 25// Uses the specified decoding strategy to obtain the text. 26HRESULT __stdcallrunFull (const sFullParams & params ,const iAudioBuffer * buffer ); 27HRESULT __stdcallrunStreamed (const sFullParams & params ,const sProgressSink & progress ,const iAudioReader * reader ); 28HRESULT __stdcallrunCapture (const sFullParams & params ,const sCaptureCallbacks & callbacks ,const iAudioCapture * reader ); 29 30HRESULT __stdcallgetResults (eResultFlags flags ,iTranscribeResult ** pp )const ; 31// Try to detect speaker by comparing channels of the stereo PCM data 32HRESULT __stdcalldetectSpeaker (const sTimeInterval & time ,eSpeakerChannel & result )const ; 33 34HRESULT __stdcallgetModel (iModel ** pp ); 35 36HRESULT __stdcallfullDefaultParams (eSamplingStrategy strategy ,sFullParams * rdi ); 37 38// Performance information 39HRESULT __stdcalltimingsPrint (); 40HRESULT __stdcalltimingsReset (); 41 }; 42 43__interface __declspec(novtable ,uuid ("abefb4c9-e8d8-46a3-8747-5afbadef1adb" ) )iModel :public IUnknown 44 { 45HRESULT __stdcallcreateContext (iContext ** pp ); 46 47HRESULT __stdcallisMultilingual (); 48 49HRESULT __stdcallgetSpecialTokens (SpecialTokens & rdi ); 50 51// Token Id -> String 52const char * __stdcall stringFromToken (whisper_token token ); 53 }; 54 55HRESULT __stdcallsetupLogger (const sLoggerSetup & setup ); 56HRESULT __stdcallloadModel (const wchar_t * path ,eModelImplementation impl ,uint32_t flags ,const sLoadModelCallbacks * callbacks ,iModel ** pp ); 57 58uint32_t __stdcallfindLanguageKeyW (const wchar_t * lang ); 59uint32_t __stdcallfindLanguageKeyA (const char * lang ); 60 61HRESULT __stdcallgetSupportedLanguages (sLanguageList & rdi ); 62} 63 64#include "sFullParams.h"