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
e8ff6c5
master
1using System . Globalization ; 2 3namespace PerfSummary 4{ 5static class Summary 6{ 7public static void ( LogData [] logs , string folder ) 8{ 9string path = Path . Combine ( folder , "summary.tsv" ); 10using var writer = File . CreateText ( path ); 11 12string [] header = new string [] 13{ 14"Audio Clip" , "Model" , "GPU" , 15"Total, sec" , "Relative speed" , 16"Encode, sec" , "Decode, sec" , 17"RAM, MB" , "VRAM, MB" 18}; 19writer . fields ( header ); 20 21foreach ( var item in logs ) 22writer . fields ( item . makeFields () ); 23} 24 25static IEnumerable < string > makeFields ( this LogData log ) 26{ 27yield return log . clip (); 28yield return log . name . model . ToString (); 29yield return log . gpu (); 30yield return log . runComplete . (); 31yield return log . relative (); 32yield return log . encode . (); 33yield return log . decode . (); 34yield return log . ram . (); 35yield return log . vram . (); 36} 37 38static string ( this double v ) => 39v . ToString ( CultureInfo . InvariantCulture ); 40 41static string relative ( this LogData log ) 42{ 43double duration ; 44switch ( log . name . clip ) 45{ 46case eInputClip . jfk : 47duration = 11 ; 48break ; 49case eInputClip . columbia : 50duration = TimeSpan . FromTicks ( 1987620000 ). TotalSeconds ; 51break ; 52default : 53throw new NotImplementedException (); 54} 55 56double rel = duration / log . runComplete ; 57return rel . ToString ( "F4" , CultureInfo . InvariantCulture ); 58} 59 60static string clip ( this LogData log ) 61{ 62return log . name . clip switch 63{ 64eInputClip . jfk => "jfk.wav" , 65eInputClip . columbia => "columbia.wma" , 66 _=> throw new ArgumentException () 67}; 68} 69 70static string gpu ( this LogData log ) 71{ 72return log . name . gpu switch 73{ 74"1080ti" => "GeForce 1080Ti" , 75"1650" => "GeForce 1650" , 76"vega7" => "Ryzen 5 5600U" , 77"vega8" => "Ryzen 7 5700G" , 78 _=> log . name . gpu 79}; 80} 81 82static void fields ( this StreamWriter writer , IEnumerable < string > fields ) 83{ 84string line = string . Join ( "\t" , fields ); 85writer . WriteLine ( line ); 86} 87} 88}