Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompting support #25

Merged
merged 4 commits into from
Jun 17, 2023

Conversation

SharafeevRavil
Copy link
Contributor

  • Had to update whisper.cpp to version 1.3.0(first release after 1.2.1 that includes the const char * initial_prompt parameter)
    • Added the byte* initial_prompt parameter following the analogy of the byte* language parameter
    • Added the whisper_state_ptr parameter to the whisper_new_segment_callback delegate to ensure correct marshalling (whisper.cpp commit)
    • Added the void* progress_callback callback to the WhisperNativeParams struct to ensure correct marshalling (whisper.cpp commit)
    • Built the 1.3.0 version of whisper.cpp for Linux and Windows. However, still need library builds for MacOS, iOS and Android. I couldn't build them as I don't have MacOS, so I would appreciate your help with that.
  • Created the 5 - Initial Prompt sample to demonstrate how the initial_prompt parameter works
    image
  • Added some simple tests to assert that the initial_prompt parameter marshals correctly, and the resulting text changes due to prompting

@Macoron
Copy link
Owner

Macoron commented May 29, 2023

Wow, amazing job!

For updating builded libraries, no worries - I will do it myself. While 1.3.0 is still considered to be beta, it's probably already stable. I will do some tests and update builded libraries in another PR. After this we can merge it in your PR.

@Macoron
Copy link
Owner

Macoron commented Jun 4, 2023

Small update from my side. I added new Github workflow to build binaries (read #27 for more details). Next I need to bump whisper.cpp version and test it on different platforms.

@Macoron
Copy link
Owner

Macoron commented Jun 14, 2023

Alright, I updated whisper.cpp to 1.4.2. Could you merge latest master into your branch? After that we can do proper review and merge your PR.


[Tooltip("Initial prompt as a string variable. " +
"It should improve transcription quality or guide it to the right direction.")]
public string initialPrompt;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add [TextArea] attribute. This will make changing it in inspector much easier.

new InitialPrompt
{
name = "UPPERCASE",
prompt = "EVERY WORD IS WRITTEN IN CAPITAL LETTERS AS IF THE CAPS LOCK KEY WAS PRESSED",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prompt for some reason doesn't work for me, but this one does.
"HELLO HOW IS IT GOING ALWAYS USE UPPERCASE NO PUNCTUATION GOODBYE ONE TWO THREE START STOP I YOU ME THEY"


namespace Whisper.Samples
{
public class InitialPromptDemo : MonoBehaviour
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this in first demo? Right now there are already a lot of scenes and it's hard to test and maintain them.

@Macoron Macoron changed the title Add prompting support #8 (upd to 1.3.0) Add prompting support Jun 17, 2023
@Macoron Macoron merged commit 269eea8 into Macoron:master Jun 17, 2023
4 checks passed
github-actions bot pushed a commit to GameWorkstore/whisper.unity that referenced this pull request Apr 2, 2024
* Add prompting support Macoron#8 (upd to 1.3.0)

* fix C# 9 target-typed new (for Unity 2019/2020)

* fixes (Macoron#25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants