whispercpp 1.2.0.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +3 -92
- data/ext/extconf.rb +9 -0
- data/ext/ggml.c +18380 -5241
- data/ext/ggml.h +2156 -502
- data/ext/ruby_whisper.cpp +13 -47
- data/ext/whisper.cpp +4182 -1787
- data/ext/whisper.h +334 -65
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3256e0c1878af91c88bf7ede04b6e422d877ea45ff84a2f6b9a253863f690b69
|
4
|
+
data.tar.gz: 662248bb96253e6baff760cc10842f9b31f7867f22ff2b584354aa321f9ffc36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f6779035eaa2cdd58dd1c7800ec0643d577e2f16e1e2c0ab6714b7a9c30ff1acc686f13878044a9835945563d3b06d19059f3343f1359663b11075ec55b5a0
|
7
|
+
data.tar.gz: 89bfbf168334ec60357a37d53fbd887f39faa73e42c677734adfa8adca3a4f374b0de28ef9a63cec327474b78ad0bd321b1e6a5a6b21a6fbd9eb51d4a82b0270
|
data/Rakefile
CHANGED
@@ -1,100 +1,11 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'open3'
|
3
1
|
require 'rake/clean'
|
4
|
-
require 'rake/testtask'
|
5
2
|
require 'rubygems/package'
|
6
3
|
|
7
|
-
|
8
|
-
|
9
|
-
CLOBBER.include 'doc'
|
10
|
-
CLOBBER.include '**/*.log'
|
11
|
-
CLOBBER.include '**/Makefile'
|
12
|
-
CLOBBER.include '**/extconf.h'
|
13
|
-
CLOBBER.include '**/extconf.h'
|
14
|
-
CLOBBER.include '**/whisper.*'
|
15
|
-
CLOBBER.include '**/ggml.*'
|
16
|
-
CLOBBER.include '**/dr_wav.h'
|
17
|
-
|
18
|
-
BUILD_VERSION=2
|
19
|
-
# Determine the current version of the software
|
20
|
-
if File.read('../../CMakeLists.txt') =~ /project.*\s*VERSION\s*(\d.+)\)/
|
21
|
-
CURRENT_VERSION = "#{$1}.#{BUILD_VERSION}"
|
22
|
-
else
|
23
|
-
CURRENT_VERSION = "0.0.0.#{BUILD_VERSION}"
|
24
|
-
end
|
25
|
-
|
26
|
-
def shell(args, opts = {})
|
27
|
-
puts "> #{args.join(' ')}"
|
28
|
-
cmd, live_stream, cwd = args, opts[:live_stdout], opts[:cwd]
|
29
|
-
Dir.chdir(cwd) {
|
30
|
-
wait_thr = nil
|
31
|
-
|
32
|
-
Open3.popen3(*cmd) do |stdin, stdout, stderr, thr|
|
33
|
-
stdin.close
|
34
|
-
wait_thr = thr # Ruby 1.8 will not yield thr, this will be nil
|
35
|
-
|
36
|
-
while line = stdout.gets do
|
37
|
-
live_stream.puts(line) if live_stream
|
38
|
-
end
|
39
|
-
|
40
|
-
while line = stderr.gets do
|
41
|
-
puts line
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
# prefer process handle directly from popen3, but if not available
|
46
|
-
# fallback to global.
|
47
|
-
p_status = wait_thr ? wait_thr.value : $?
|
48
|
-
exit_code = p_status.exitstatus
|
49
|
-
error = (exit_code != 0)
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
|
54
|
-
MAKECMD = ENV['MAKE_CMD'] || make_program
|
55
|
-
MAKEOPTS = ENV['MAKE_OPTS'] || ''
|
56
|
-
WHISPER_SO = "ext/whisper.#{(defined?(RbConfig) ? RbConfig : Config)::MAKEFILE_CONFIG['DLEXT']}"
|
57
|
-
|
58
|
-
file 'ext/Makefile' => 'ext/extconf.rb' do
|
59
|
-
shell(['ruby', 'extconf.rb', ENV['EXTCONF_OPTS'].to_s],
|
60
|
-
{ live_stdout: STDOUT, cwd: "#{Dir.pwd}/ext" }
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
def make(target = '')
|
65
|
-
shell(["#{MAKECMD}", "#{MAKEOPTS}", "#{target}"].reject(&:empty?),
|
66
|
-
{ live_stdout: STDOUT, cwd: "#{Dir.pwd}/ext" }
|
67
|
-
)
|
68
|
-
end
|
69
|
-
|
70
|
-
# Let make handle dependencies between c/o/so - we'll just run it.
|
71
|
-
file WHISPER_SO => (['ext/Makefile'] + Dir['ext/*.cpp'] + Dir['ext/*.c'] + Dir['ext/*.h']) do
|
72
|
-
make
|
73
|
-
end
|
74
|
-
|
75
|
-
desc "Compile the shared object"
|
76
|
-
task :compile => [WHISPER_SO]
|
77
|
-
|
78
|
-
desc "Default Task (Test project)"
|
79
|
-
task :default => :test
|
80
|
-
|
81
|
-
Rake::TestTask.new(:test) do |t|
|
82
|
-
t.test_files = FileList['tests/test_*.rb']
|
83
|
-
t.verbose = false
|
84
|
-
end
|
85
|
-
|
86
|
-
desc 'Generate gem specification'
|
87
|
-
task :gemspec do
|
88
|
-
system("cp ../../LICENSE .")
|
89
|
-
system("cp ../../README.md .")
|
90
|
-
tspec = ERB.new(File.read(File.join(File.dirname(__FILE__),'lib','whispercpp.gemspec.erb')))
|
91
|
-
File.open(File.join(File.dirname(__FILE__),'whispercpp.gemspec'),'wb') do|f|
|
92
|
-
f << tspec.result
|
93
|
-
end
|
94
|
-
end
|
4
|
+
# default package task
|
5
|
+
task :default => [:package]
|
95
6
|
|
96
7
|
desc 'Build gem'
|
97
|
-
task :package
|
8
|
+
task :package do
|
98
9
|
spec_source = File.read File.join(File.dirname(__FILE__),'whispercpp.gemspec')
|
99
10
|
spec = nil
|
100
11
|
# see: http://gist.github.com/16215
|
data/ext/extconf.rb
CHANGED
@@ -3,6 +3,15 @@ system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.cpp')} .")
|
|
3
3
|
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.h')} .")
|
4
4
|
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.h')} .")
|
5
5
|
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.c')} .")
|
6
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-impl.h')} .")
|
7
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-alloc.h')} .")
|
8
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-alloc.c')} .")
|
9
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-backend-impl.h')} .")
|
10
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-backend.h')} .")
|
11
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-backend.c')} .")
|
12
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-common.h')} .")
|
13
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-quants.h')} .")
|
14
|
+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml-quants.c')} .")
|
6
15
|
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','examples','dr_wav.h')} .")
|
7
16
|
|
8
17
|
|