This commit is contained in:
Demian 2026-08-15 12:11:04 +08:00 committed by GitHub
commit 383ddaad2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 17 additions and 19 deletions

View File

@ -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() {
@ -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.
@ -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:
@ -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.

View File

@ -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"
)
///////////////////////////////////////////////////////////////////////////////

View File

@ -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() {

View File

@ -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"
)

View File

@ -1,4 +1,4 @@
module github.com/ggerganov/whisper.cpp/bindings/go
module github.com/ggml-org/whisper.cpp/bindings/go
go 1.23

View File

@ -4,7 +4,7 @@ import (
"errors"
// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)
///////////////////////////////////////////////////////////////////////////////

View File

@ -8,7 +8,7 @@ import (
"time"
// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)
///////////////////////////////////////////////////////////////////////////////
@ -370,7 +370,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{

View File

@ -5,7 +5,7 @@ import (
"strings"
"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"
)

View File

@ -6,7 +6,7 @@ import (
"runtime"
// Bindings
whisper "github.com/ggerganov/whisper.cpp/bindings/go"
whisper "github.com/ggml-org/whisper.cpp/bindings/go"
)
///////////////////////////////////////////////////////////////////////////////

View File

@ -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"
)
@ -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) {

View File

@ -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:
//

View File

@ -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"
)
@ -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