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

KonstantinSource codes8c4603c

master
858 B37 linesraw
1#pragma once
2#include "DecoderTensors.h"
3#include <atlstr.h>
4#include <atlcoll.h>
5#include "../../ComLightLib/streams.h"
6
7namespace CpuCompute
8{
9	__interface iLoaderProgressSink
10	{
11		HRESULT gotBytes( int64_t cb );
12	};
13
14	class HybridLoader
15	{
16		DecoderTensors& destination;
17		CAtlMap<CStringA, Tensor*> map;
18		size_t bufferBytes = 0;
19
20		struct alignas( 32 ) PendingTensor
21		{
22			Tensor* destPointer = nullptr;
23			int64_t streamOffset = 0;
24			size_t bufferOffset = 0;
25			size_t payloadBytes = 0;
26		};
27		std::vector<PendingTensor> pending;
28
29	public:
30
31		HybridLoader( DecoderTensors& m, int countLayers );
32
33		HRESULT setupTensor( const CStringA& name, int n_dims, int ftype, const std::array<int, 4>& ne, ComLight::iReadStream* stream, int64_t& postponedBytes );
34
35		HRESULT completeLoad( ComLight::iReadStream* stream, iLoaderProgressSink& progressSink );
36	};
37}