Skip to content

Commit b623ca4

Browse files
taf2ggerganov
andauthored
bindings : add Ruby (#500)
* adding ruby bindings * avoid adding these they are copied in via extconf.rb * ignore these files here * add definitions for boolean params * initial transcribe for ruby * use en model and transcribe jfk with assertion * possibly this works for building ruby binding * ci : try to add ruby workflow --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 69e6e46 commit b623ca4

File tree

7 files changed

+630
-1
lines changed

7 files changed

+630
-1
lines changed

.github/workflows/bindings.yml renamed to .github/workflows/bindings-go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Bindings Tests
1+
name: Bindings Tests (Go)
22
on:
33
push:
44
paths:

.github/workflows/bindings-ruby.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Bindings Tests (Ruby)
2+
on:
3+
push:
4+
paths:
5+
- bindings/ruby/**
6+
- whisper.h
7+
pull_request:
8+
paths:
9+
- bindings/ruby/**
10+
- whisper.h
11+
12+
jobs:
13+
ubuntu-latest:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: '3.0'
19+
- uses: actions/checkout@v1
20+
- run: |
21+
cd bindings/ruby/ext
22+
ruby extconf.rb && make

bindings/ruby/ext/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Makefile
2+
ggml.c
3+
ggml.h
4+
whisper.bundle
5+
whisper.cpp
6+
whisper.h
7+
dr_wav.h

bindings/ruby/ext/extconf.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require 'mkmf'
2+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.cpp')} .")
3+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.h')} .")
4+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.h')} .")
5+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.c')} .")
6+
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','examples','dr_wav.h')} .")
7+
8+
9+
# need to use c++ compiler flags
10+
$CXXFLAGS << ' -std=c++11'
11+
# Set to true when building binary gems
12+
if enable_config('static-stdlib', false)
13+
$LDFLAGS << ' -static-libgcc -static-libstdc++'
14+
end
15+
16+
if enable_config('march-tune-native', false)
17+
$CFLAGS << ' -march=native -mtune=native'
18+
$CXXFLAGS << ' -march=native -mtune=native'
19+
end
20+
21+
create_makefile('whisper')

0 commit comments

Comments
 (0)