Git Product home page Git Product logo

whisper.unity's Introduction

whisper.unity

License: MIT whisper.cpp

Testing

This is Unity3d bindings for the whisper.cpp. It provides high-performance inference of OpenAI's Whisper automatic speech recognition (ASR) model running on your local machine.

This repository comes with "ggml-tiny.bin" model weights. This is the smallest and fastest version of whisper model, but it has worse quality comparing to other models. If you want better quality, check out other models weights.

Main features:

  • Multilingual, supports around 60 languages
  • Can translate one language to another (e.g. German speech to English text)
  • Different models sizes offering speed and accuracy tradeoffs
  • Runs on local users device without Internet connection
  • Free and open source, can be used in commercial projects

Supported platforms:

Samples

multilang.mp4

"whisper-small.bin" model tested in English, German and Russian from microphone

tiny.mp4

"whisper-tiny.bin" model, 50x faster than realtime on Macbook with M1 Pro

Getting started

Clone this repository and open it as regular Unity project. It comes with examples and tiny multilanguage model weights.

Alternatively you can add this repository to your project as a Unity Package. Add it by this git URL to your Unity Package Manager:

https://github.com/Macoron/whisper.unity.git?path=/Packages/com.whisper.unity

CUDA Support

Unity project compiled with enabled CUDA expects your end-users to have Nvidia GPU and CUDA libraries. Trying to run build without it will result error.

To run inference with CUDA, you would need to have supported GPU and installed CUDA Toolkit (tested with 12.2.0).

After that go to the Project Settings => Whisper => Enable CUDA. This should force package to use library compiled for CUDA.

Metal Support

Whisper.cpp supports Metal only on Apple7 GPUs family or newer (starting from Apple M1 chips). Trying to run on older hardware will fallback to CPU inference.

To activate Metal inference, go to Project Settings => Whisper => Enable Metal. This should force package to use library compiled for Metal.

Downloading other model weights

You can try different Whisper model weights. For example, you can improve English language transcription by using English-only weights or by trying bigger models.

You can download model weights from here. Just put them into your StreamingAssets folder.

For more information about models differences and formats read whisper.cpp readme and OpenAI readme.

Compiling C++ libraries from source

This project comes with prebuild libraries of whisper.cpp for all supported platforms. You can rebuild them from source using Github Actions. To do that make fork of this repo and go into Actions => Build C++ => Run workflow. After pipeline completed, download compiled libraries in artifacts tab.

In case you want to build libraries on your machine:

  1. Clone the original whisper.cpp repository
  2. Checkout tag v1.5.1. Other versions might not work with this Unity bindings.
  3. Open whisper.unity folder with command line
  4. If you are using Windows write:
.\build_cpp.bat cpu path\to\whisper
  1. If you are using MacOS write:
sh build_cpp.sh path/to/whisper all path/to/ndk/android.toolchain.cmake
  1. If you are using Linux write
sh build_cpp_linux.sh path/to/whisper cpu
  1. If build was successful compiled libraries should be automatically update package Plugins folder.

Windows will produce only Windows library, Linux will produce only Linux. MacOS will produce MacOS, iOS and Android libraries.

MacOS build script was tested on Mac with ARM processor. For Intel processors you might need change some parameters.

License

This project is licensed under the MIT License.

It uses compiled libraries and model weighs of whisper.cpp which is under MIT license.

Original OpenAI Whisper code and weights are also under MIT license.

whisper.unity's People

Contributors

macoron avatar sharafeevravil avatar achimmihca avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.