bits-by-brandon / whisper-ui

A GUI interface for Open AI Whisper based on Tauri and Sveltekit
110 stars 10 forks source link

build failed on M1 Mac #3

Open ghost opened 1 year ago

ghost commented 1 year ago

how to build on M1? I tried npm run tauri build and end with error below

error: failed to run custom build command for whisper-ui v0.0.0 (/Users/chenzhiyu/Downloads/whisper-ui-main/src-tauri)

Caused by:
  process didn't exit successfully: `/Users/username/Downloads/whisper-ui-main/src-tauri/target/release/build/whisper-ui-37424a52488d5e66/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  path matching binaries/whisper-aarch64-apple-darwin not found.
warning: build failed, waiting for other jobs to finish...
       Error failed to build app: failed to build app
JugoBonito commented 1 year ago

I had the same issue, the problem is that you don't habe the binaries downloaded as the project doesn't support git lfs. You can downlad the files from the whisper.cpp repo, name them correctly and the put them in the src-tauri/binaries folder. Hope this helps :)

jsmollin commented 1 year ago

I had the same issue, the problem is that you don't habe the binaries downloaded as the project doesn't support git lfs. You can downlad the files from the whisper.cpp repo, name them correctly and the put them in the src-tauri/binaries folder. Hope this helps :)

Could you please provide more information on how the binaries need to be named?

JugoBonito commented 1 year ago

Setting up Whisper for Mac OS on Github

To set up Whisper on Mac OS, you need to follow these steps:

  1. Download ffmpeg and ffprobe from ffmpeg.org/download.html. Rename them to ffmpeg-x86_64-apple-darwin and ffprobe-x86_64-apple-darwin.

  2. Follow the guide provided in blog.castopod.org/install-whisper-cpp-on-your-mac-in-5mn-and-transcribe-all-your-podcasts-for-free/ to obtain the whisper.cpp file for Mac OS.

  3. Rename the whisper binary to whisper-x86_64-apple-darwin.

  4. Download the model of your choice from huggingface.co/ggerganov/whisper.cpp or ggml.ggerganov.com/.

  5. Place the downloaded model file in the src-tauri/resources/models folder.

  6. Change the name of the modelpath variable in the src/lib/util/whisper.ts file to the name of your model.

If you have any other questions, please post them here and I will try to help you. :)

jsmollin commented 1 year ago

From your instructions, I got the program to build and launch on Linux. Thank you so much! When I try to upload an audio file (e.g., .mp3) to transcribe, the program does not get past determining length and when I ask it to transcribe, it says that something went wrong. I suspect that it may have something to do with the ffmpeg binary. Do you have any ideas on this?

JugoBonito commented 1 year ago

Troubleshooting Whisper on Linux for Github

If you are having issues with Whisper on Linux, here are some troubleshooting steps:

  1. Check the console log files for any errors and paste them into Chat GPT for assistance.

  2. Verify that the file naming conventions are correct for Linux. On Linux, files should have "unknown-linux-gnu" instead of "apple-darwin" in the name. More information can be found here: tauri.app/v1/api/config/#bundleconfig.externalbin:~:text=the%20macOS%20bundles.-externalBin-array%3F.

Try these steps and let me know if you need further assistance.

hdoro commented 1 year ago

For those trying @JugoBonito 's approach (which works, thank you Philipp!), here's how I went about it, modifying the original step-by-step:

Setting up Whisper for Mac OS on Github (modified)

To set up Whisper on Mac OS, you need to follow these steps:

1. Run tauri dev and notice the error your get

Tauri will emit something like:

Caused by:
  process didn't exit successfully: `/Users/username/Downloads/whisper-ui-main/src-tauri/target/release/build/whisper-ui-37424a52488d5e66/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=TAURI_CONFIG
  cargo:rerun-if-changed=tauri.conf.json
  cargo:rustc-cfg=desktop
  path matching binaries/whisper-aarch64-apple-darwin not found.
warning: build failed, waiting for other jobs to finish...
       Error failed to build app: failed to build app

Notice the error is hidden between the last cargo:rustc and the warning:

**path matching binaries/whisper-aarch64-apple-darwin not found.**

This aarch64 is the platform the app inferred from your system. It could be something else, take note of it - we'll use it later on.

2. Download ffmpeg and ffprobe from ffmpeg.org/download.html

Screenshot of ffmeg's site

Screenshot of the download site

Unzip these files and move their executable file into src-tauri/binaries of this repository. Now, rename each of them to include the platform we found in step 1.:

3. Download Whisper.cpp & models of choice

Follow the guide provided in blog.castopod.org/install-whisper-cpp-on-your-mac-in-5mn-and-transcribe-all-your-podcasts-for-free/ to clone, compile and download your model of choice for whisper.cpp.

In the folder of the whisper.cpp repository, copy the main executable into src-tauri/binaries of the whisper-ui repository and rename it to whisper.

Then, copy the model you've downloaded from the models folder into src-tauri/resources/models. In my case, it was whisper.cpp/models/ggml-medium.bin -> whisper-ui/src-tauri/resources/models/ggml-medium.bin.

4. configure the whisper-ui app

Change the name of the modelpath variable in the src/lib/util/whisper.ts file to the name of your model.

(Optional) if transcribing languages other than English, still in the whisper.ts file you can add your language of choice in the Whisper CLI command arguments of the transcribe variable:

const transcribe = Command.sidecar('binaries/whisper', [
  '-m',
  modelPath,
  '-f',
  file.transformedPath,
  '--language',
  "pt" // your language code here
]);
bits-by-brandon commented 1 year ago

Hello! Sorry I've basically abandoned this project, but I didn't realize how many people actually were still using it.

I'd love to fix the issues with bundling binaries, but I'm not really that experienced with it. I'll be happy to accept any PRs or advice on how to get the binaries bundled to make this usable out of the box!

JugoBonito commented 1 year ago

It is really hard as the Files are so big, i think the easiest Solution would be to add a Download link to the binaries and a Guide on how to install them somewhere in the readme. But honestly mate your project is really awesome on once you get it to run it works really good.

bits-by-brandon commented 1 year ago

@JugoBonito makes sense. What I might try do then is see if I can get this to build with no binaries, then have the client download and save the binaries with a few clicks without messing with the source

JugoBonito commented 12 months ago

That would be very cool

jsmollin commented 9 months ago

@JugoBonito makes sense. What I might try do then is see if I can get this to build with no binaries, then have the client download and save the binaries with a few clicks without messing with the source

Any progress on this?

rdewolff commented 5 months ago

any update on this?