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#include "stdafx.h" 2#include "KvTensors.h" 3using namespace CpuCompute ; 4 5// Create these two large tensors, FP16 precision 6HRESULT KvTensors ::create (const Whisper ::sModelParams & mp ) 7{ 8const uint32_t n_mem = mp .n_text_layer * mp .n_text_ctx ; 9const uint32_t n_elements = mp .n_text_state * n_mem ; 10 11const size_t cb = sizeof (uint16_t )* (size_t )n_elements * 2 ; 12CHECK (memory .allocate (cb ) ); 13 14uint16_t * pointer = (uint16_t * )memory .pointer (); 15keys = pointer ; 16values = pointer + n_elements ; 17size = n_elements ; 18return S_OK ; 19}