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
8c4603c
master
1// Missing XML comment for publicly visible type or member 2// TODO: remove this line and document them. 3#pragma warning disableCS1591 4 5namespace Whisper 6{ 7/// <summary>Available sampling strategies</summary> 8public enum eSamplingStrategy : int 9{ 10/// <summary>Always select the most probable token</summary> 11Greedy , 12/// <summary>TODO: not implemented yet!</summary> 13BeamSearch , 14} ; 15 16[ Flags ] 17public enum eFullParamsFlags : uint 18{ 19None = 0 , 20Translate = 1 , 21NoContext = 2 , 22SingleSegment = 4 , 23PrintSpecial = 8 , 24PrintProgress = 0x10 , 25PrintRealtime = 0x20 , 26PrintTimestamps = 0x40 , 27 28// Experimental 29TokenTimestamps = 0x100 , 30SpeedupAudio = 0x200 , 31} ; 32 33/// <summary>Transcribe parameters</summary> 34public struct Parameters 35{ 36/// <summary>Sampling strategy</summary> 37public eSamplingStrategy strategy ; 38 39/// <summary>Count of CPU worker threads to use</summary> 40/// <remarks>So far, the GPU model only uses CPU threads for MEL spectrograms</remarks> 41public int cpuThreads ; 42 43public int n_max_text_ctx ; 44/// <summary>start offset in ms</summary> 45public int offset_ms ; 46/// <summary>audio duration to process in ms</summary> 47public int duration_ms ; 48public eFullParamsFlags flags ; 49 50/// <summary>Set or clear the specified flag in the <see cref="flags" /> field of this structure</summary> 51public void setFlag ( eFullParamsFlags flag , bool set ) 52{ 53if ( flag != eFullParamsFlags . None ) 54{ 55if ( set ) 56flags |= flag ; 57else 58flags &= ~ flag ; 59return ; 60} 61throw new ArgumentException (); 62} 63 64/// <summary>Language</summary> 65public eLanguage language ; 66 67// [EXPERIMENTAL] token-level timestamps 68/// <summary>timestamp token probability threshold (~0.01)</summary> 69public float thold_pt ; 70/// <summary>timestamp token sum probability threshold (~0.01)</summary> 71public float thold_ptsum ; 72/// <summary>max segment length in characters</summary> 73public int max_len ; 74/// <summary>max tokens per segment (0 = no limit)</summary> 75public int max_tokens ; 76 77public struct sGreedy 78{ 79public int n_past ; 80} 81public sGreedy greedy ; 82 83public struct sBeamSearch 84{ 85public int n_past ; 86public int beam_width ; 87public int n_best ; 88} 89public sBeamSearch beamSearch ; 90 91// [EXPERIMENTAL] speed-up techniques 92/// <summary>overwrite the audio context size (0 = use default)</summary> 93public int audioContextSize ; 94} 95}