Skip to content

Commit

Permalink
bindings : add Ruby (ggerganov#500)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
taf2 and ggerganov authored Feb 15, 2023
1 parent 69e6e46 commit b623ca4
Show file tree
Hide file tree
Showing 7 changed files with 630 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bindings Tests
name: Bindings Tests (Go)
on:
push:
paths:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/bindings-ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Bindings Tests (Ruby)
on:
push:
paths:
- bindings/ruby/**
- whisper.h
pull_request:
paths:
- bindings/ruby/**
- whisper.h

jobs:
ubuntu-latest:
runs-on: ubuntu-latest
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- uses: actions/checkout@v1
- run: |
cd bindings/ruby/ext
ruby extconf.rb && make
7 changes: 7 additions & 0 deletions bindings/ruby/ext/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Makefile
ggml.c
ggml.h
whisper.bundle
whisper.cpp
whisper.h
dr_wav.h
21 changes: 21 additions & 0 deletions bindings/ruby/ext/extconf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'mkmf'
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.cpp')} .")
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','whisper.h')} .")
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.h')} .")
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','ggml.c')} .")
system("cp #{File.join(File.dirname(__FILE__),'..','..','..','examples','dr_wav.h')} .")


# need to use c++ compiler flags
$CXXFLAGS << ' -std=c++11'
# Set to true when building binary gems
if enable_config('static-stdlib', false)
$LDFLAGS << ' -static-libgcc -static-libstdc++'
end

if enable_config('march-tune-native', false)
$CFLAGS << ' -march=native -mtune=native'
$CXXFLAGS << ' -march=native -mtune=native'
end

create_makefile('whisper')
Loading

0 comments on commit b623ca4

Please sign in to comment.