Commit Graph

8 Commits

Author SHA1 Message Date
Tamotsu Takahashi d0f38def08 Expose more ctx->vocab interfaces.
I need these functions to implement a kind of weighting coefficient
logits_filter_callback like:

```

void filter_callback(
            struct whisper_context * ctx,
              struct whisper_state * state,
          const whisper_token_data * tokens,
                               int   n_tokens,
                             float * logits,
                              void * user_data
) {
    const static std::vector<std::string> good_words = {
        "音声", "認識"
    };
    std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv;
    auto prev = n_tokens > 0 ? std::string(whisper_token_to_str(ctx, tokens[n_tokens - 1].id)) : "";

    for (const std::string & token : good_words) {
        auto s32 = conv.from_bytes(token);
        auto s0 = conv.to_bytes(s32[0]);
        auto s1 = conv.to_bytes(s32[1]);

        if (whisper_token_exists(ctx, token.c_str())) {
            logits[whisper_str_to_token(ctx, token.c_str())] *= 2;
        } else if (
            prev.size() >= s0.size()
            && prev.compare(prev.size() - s0.size(), s0.size(), s0) == 0
            && whisper_token_exists(ctx, s1.c_str())
        ) {
            logits[whisper_str_to_token(ctx, s1.c_str())] *= 1.6;
        } else if (whisper_token_exists(ctx, s0.c_str())) {
            logits[whisper_str_to_token(ctx, s0.c_str())] *= 1.2;
        }
    }
}
```
2025-01-01 23:44:29 +09:00
Karthick f897eb7670
whisper : support no_speech_thold (#2625)
* Implement no_speech_thold

no_speech_thold functionality is on par with OpenAI's whisper

* Addressed review comments
2024-12-17 19:15:47 +02:00
Georgi Gerganov c0a9f8ef85 whisper : include ggml-cpu.h (#0) 2024-11-15 15:21:04 +02:00
Jhen-Jie Hong 5f8a086e22
whisper.swiftui : add model download list & bench methods (#2546)
* swift : fix resources & exclude build

* whisper : impl whisper_timings struct & api

* whisper.swiftui : model list & bench methods

* whisper : return ptr for whisper_get_timings

* revert unnecessary change

* whisper : avoid designated initializer

* whisper.swiftui: code style changes

* whisper.swiftui : get device name / os from UIDevice

* whisper.swiftui : fix UIDevice usage

* whisper.swiftui : add memcpy and ggml_mul_mat (commented)
2024-11-13 21:51:34 +02:00
Rotem Dan b6049060dd
whisper : add dtw preset for large-v3-turbo (#2481) 2024-10-15 21:00:21 +03:00
Sandro Hanea fdbfb460ed
whisper : add OpenVINO init with state (#2464)
* Fixed OpenVino init on state

* Removed an empty line

* Fixed typo

* Replaced tabs with spaces

---------

Co-authored-by: Sandro Hanea <sandrohanea@users.noreply.github.com>
2024-10-08 20:08:00 +03:00
Georgi Gerganov 1789abca84
whisper : remove mel leftover constants (396089f) 2024-10-05 16:13:03 +03:00
Georgi Gerganov e30c679928
whisper : reorganize source code + improve CMake (#2256)
* scripts : update sync [no ci]

* files : reorganize [no ci]

* sync : llama.cpp

* cmake : link math library

* cmake : build normal ggml library

* files : move headers to include

* objc : fix path to ggml-metal.h

* ci : fix WHISPER_CUDA -> GGML_CUDA

* scripts : sync LICENSE [no ci]
2024-06-26 19:34:09 +03:00