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

KonstantinDLL API for diarize featuree1e3ac0

master
2.6 KiB69 linesraw
1#pragma once
2#include "../../ComLightLib/comLightCommon.h"
3#include "iTranscribeResult.cl.h"
4#include "SpecialTokens.h"
5#include "loggerApi.h"
6#include "sLanguageList.h"
7#include "sLoadModelCallbacks.h"
8#include "eGpuModelFlags.h"
9
10namespace Whisper
11{
12	struct iModel;
13	struct iAudioBuffer;
14	struct iAudioReader;
15	struct iAudioCapture;
16	struct sCaptureCallbacks;
17	struct sFullParams;
18	enum struct eModelImplementation : uint32_t;
19	enum struct eSamplingStrategy : int;
20	using whisper_token = int;
21	struct sProgressSink;
22
23	struct DECLSPEC_NOVTABLE iContext : public ComLight::IUnknown
24	{
25		DEFINE_INTERFACE_ID( "{b9956374-3b18-4943-90f2-2ab18a404537}" );
26
27		// Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text
28		// Uses the specified decoding strategy to obtain the text.
29		virtual HRESULT COMLIGHTCALL runFull( const sFullParams& params, const iAudioBuffer* buffer ) = 0;
30		virtual HRESULT COMLIGHTCALL runStreamed( const sFullParams& params, const sProgressSink& progress, const iAudioReader* reader ) = 0;
31		virtual HRESULT COMLIGHTCALL runCapture( const sFullParams& params, const sCaptureCallbacks& callbacks, const iAudioCapture* reader ) = 0;
32
33		virtual HRESULT COMLIGHTCALL getResults( eResultFlags flags, iTranscribeResult** pp ) const = 0;
34		// Try to detect speaker by comparing channels of the stereo PCM data
35		virtual HRESULT COMLIGHTCALL detectSpeaker( const sTimeInterval& time, eSpeakerChannel& result ) const = 0;
36
37		virtual HRESULT COMLIGHTCALL getModel( iModel** pp ) = 0;
38
39		virtual HRESULT COMLIGHTCALL fullDefaultParams( eSamplingStrategy strategy, sFullParams* rdi ) = 0;
40
41		// Performance information
42		virtual HRESULT COMLIGHTCALL timingsPrint() = 0;
43		virtual HRESULT COMLIGHTCALL timingsReset() = 0;
44	};
45
46	struct DECLSPEC_NOVTABLE iModel : public ComLight::IUnknown
47	{
48		DEFINE_INTERFACE_ID( "{abefb4c9-e8d8-46a3-8747-5afbadef1adb}" );
49
50		virtual HRESULT COMLIGHTCALL createContext( iContext** pp ) = 0;
51
52		virtual HRESULT COMLIGHTCALL isMultilingual() = 0;
53
54		virtual HRESULT COMLIGHTCALL getSpecialTokens( SpecialTokens& rdi ) = 0;
55
56		// Token Id -> String
57		virtual const char* COMLIGHTCALL stringFromToken( whisper_token token ) = 0;
58	};
59
60	HRESULT COMLIGHTCALL setupLogger( const sLoggerSetup& setup );
61	HRESULT COMLIGHTCALL loadModel( const wchar_t* path, eModelImplementation impl, uint32_t flags, const sLoadModelCallbacks* callbacks, iModel** pp );
62
63	uint32_t COMLIGHTCALL findLanguageKeyW( const wchar_t* lang );
64	uint32_t COMLIGHTCALL findLanguageKeyA( const char* lang );
65
66	HRESULT COMLIGHTCALL getSupportedLanguages( sLanguageList& rdi );
67}
68
69#include "sFullParams.h"