Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions bindings/go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ is as follows:

```go
import (
"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
"github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
)

func main() {
Expand Down Expand Up @@ -84,7 +84,7 @@ And you can then test a model against samples with the following command:

To use the bindings in your own software,

1. Import `github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper` (or `github.com/ggerganov/whisper.cpp/bindings/go` into your package;
1. Import `github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper` (or `github.com/ggml-org/whisper.cpp/bindings/go` into your package;
2. Compile `libwhisper.a` (you can use `make whisper` in the `bindings/go` directory);
3. Link your go binary against whisper by setting the environment variables `C_INCLUDE_PATH` and `LIBRARY_PATH`
to point to the `whisper.h` file directory and `libwhisper.a` file directory respectively.
Expand All @@ -93,8 +93,8 @@ Look at the `Makefile` in the `bindings/go` directory for an example.

The API Documentation:

* https://pkg.go.dev/github.com/ggerganov/whisper.cpp/bindings/go
* https://pkg.go.dev/github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper
* https://pkg.go.dev/github.com/ggml-org/whisper.cpp/bindings/go
* https://pkg.go.dev/github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper

Getting help:

Expand All @@ -103,4 +103,3 @@ Getting help:
## License

The license for the Go bindings is the same as the license for the rest of the whisper.cpp project, which is the MIT License. See the `LICENSE` file for more details.

2 changes: 1 addition & 1 deletion bindings/go/examples/go-whisper/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

// Packages
whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
whisper "github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/examples/go-whisper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"

// Packages
whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
whisper "github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/examples/go-whisper/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

// Package imports
whisper "github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
whisper "github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
wav "github.com/go-audio/wav"
)

Expand Down
2 changes: 1 addition & 1 deletion bindings/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/ggerganov/whisper.cpp/bindings/go
module github.com/ggml-org/whisper.cpp/bindings/go

go 1.23

Expand Down
2 changes: 1 addition & 1 deletion bindings/go/pkg/whisper/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"

// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions bindings/go/pkg/whisper/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -334,7 +334,7 @@ func toSegment(ctx *whisper.Context, n int) Segment {

func toTokens(ctx *whisper.Context, n int) []Token {
result := make([]Token, ctx.Whisper_full_n_tokens(n))
for i := 0; i < len(result); i++ {
for i := range result {
data := ctx.Whisper_full_get_token_data(n, i)

result[i] = Token{
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/pkg/whisper/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"testing"

"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
"github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
"github.com/go-audio/wav"
assert "github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/pkg/whisper/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"runtime"

// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)

///////////////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 1 addition & 2 deletions bindings/go/pkg/whisper/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package whisper_test
import (
"testing"

"github.com/ggerganov/whisper.cpp/bindings/go/pkg/whisper"
"github.com/ggml-org/whisper.cpp/bindings/go/pkg/whisper"
assert "github.com/stretchr/testify/assert"
)

Expand All @@ -14,7 +14,6 @@ func TestNew(t *testing.T) {
assert.NoError(err)
assert.NotNil(model)
defer model.Close()

})

t.Run("invalid model path", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion bindings/go/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (ctx *Context) Whisper_full_parallel(params Params, samples []float32, proc

// Return the id of the autodetected language, returns -1 if not found
// Added to whisper.cpp in
// https://github.com/ggerganov/whisper.cpp/commit/a1c1583cc7cd8b75222857afc936f0638c5683d6
// https://github.com/ggml-org/whisper.cpp/commit/a1c1583cc7cd8b75222857afc936f0638c5683d6
//
// Examples:
//
Expand Down
4 changes: 2 additions & 2 deletions bindings/go/whisper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

// Packages
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
wav "github.com/go-audio/wav"
assert "github.com/stretchr/testify/assert"
)
Expand Down Expand Up @@ -58,7 +58,7 @@ func Test_Whisper_001(t *testing.T) {
// Print out tokens
num_segments := ctx.Whisper_full_n_segments()
assert.GreaterOrEqual(num_segments, 1)
for i := 0; i < num_segments; i++ {
for i := range num_segments {
str := ctx.Whisper_full_get_segment_text(i)
assert.NotEmpty(str)
t0 := time.Duration(ctx.Whisper_full_get_segment_t0(i)) * time.Millisecond
Expand Down
Loading