{"id":19805457,"url":"https://github.com/argmaxinc/whisperkittools","last_synced_at":"2025-04-12T20:45:44.093Z","repository":{"id":220017290,"uuid":"750071113","full_name":"argmaxinc/whisperkittools","owner":"argmaxinc","description":"Python tools for WhisperKit: Model conversion, optimization and evaluation","archived":false,"fork":false,"pushed_at":"2025-01-20T23:05:44.000Z","size":168,"stargazers_count":209,"open_issues_count":1,"forks_count":63,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-04T01:06:15.381Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/argmaxinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-29T23:33:41.000Z","updated_at":"2025-03-30T18:37:53.000Z","dependencies_parsed_at":"2025-01-04T03:06:05.304Z","dependency_job_id":"81037003-8796-416e-8438-323bbf6d6db4","html_url":"https://github.com/argmaxinc/whisperkittools","commit_stats":{"total_commits":19,"total_committers":2,"mean_commits":9.5,"dds":"0.052631578947368474","last_synced_commit":"ec78efd3a607e274dc104f8fb30ffcabe246f70b"},"previous_names":["argmaxinc/whisperkittools"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argmaxinc%2Fwhisperkittools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argmaxinc%2Fwhisperkittools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argmaxinc%2Fwhisperkittools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/argmaxinc%2Fwhisperkittools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/argmaxinc","download_url":"https://codeload.github.com/argmaxinc/whisperkittools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631692,"owners_count":21136559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T09:04:01.774Z","updated_at":"2025-04-12T20:45:44.070Z","avatar_url":"https://github.com/argmaxinc.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://github.com/argmaxinc/WhisperKit#gh-light-mode-only\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/f0699c07-c29f-45b6-a9c6-f6d491b8f791\" alt=\"WhisperKit\" width=\"20%\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://github.com/argmaxinc/WhisperKit#gh-dark-mode-only\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/1be5e31c-de42-40ab-9b85-790cb911ed47\" alt=\"WhisperKit\" width=\"20%\" /\u003e\n\u003c/a\u003e\n\n# whisperkittools\n\u003c/div\u003e\n\n+![Unit and Functional Tests](https://github.com/argmaxinc/whisperkittools/actions/workflows/public-ci.yml/badge.svg)\n\nPython tools for [WhisperKit](https://github.com/argmaxinc/whisperkit) and [WhisperKitAndroid](https://github.com/argmaxinc/WhisperKitAndroid)\n- Convert PyTorch Whisper models to WhisperKit format\n- Apply custom inference optimizations and model compression\n- Evaluate Whisper using WhisperKit and other Whisper implementations on benchmarks\n\n\u003e [!IMPORTANT]\n\u003e If you are looking for more features such as speaker diarization and upgraded performance, check out [WhisperKit Pro](https://huggingface.co/argmaxinc/whisperkit-pro)!\n\n## Table of Contents\n- [Installation](#installation)\n- [Model Generation (Apple)](#model-generation)\n- [Model Generation (Android)](#model-generation-android)\n- [Model Evaluation (Apple)](#evaluate)\n- [Python Inference](#python-inference)\n- [Example SwiftUI App](#example-swiftui-app)\n- [Quality-of-Inference](#qoi)\n- [FAQ](#faq)\n- [Citation](#citation)\n\n\n## Installation\n- **Step 1:** [Fork this repository](https://github.com/argmaxinc/whisperkittools/fork)\n- **Step 2:** Create a Python virtual environment, e.g.:\n```shell\nconda create -n whisperkit python=3.11 -y \u0026\u0026 conda activate whisperkit\n```\n- **Step 3:** Install the base package as editable\n```shell\ncd WHISPERKIT_ROOT_DIR \u0026\u0026 pip install -e .\n```\n\n## \u003ca name=\"model-generation-apple\"\u003e\u003c/a\u003e Model Generation (Apple)\nConvert [Hugging Face Whisper Models](https://huggingface.co/models?search=whisper) (PyTorch) to [WhisperKit](https://github.com/argmaxinc/whisperkit) (Core ML) format:\n\n```shell\nwhisperkit-generate-model --model-version \u003cmodel-version\u003e --output-dir \u003coutput-dir\u003e\n```\nFor optional arguments related to model optimizations, please see the help menu with `-h`\n\n### \u003ca name=\"publish-custom-model\"\u003e\u003c/a\u003e Publishing Models\nWe host several popular Whisper model versions [here](https://huggingface.co/argmaxinc/whisperkit-coreml/tree/main). These hosted models are automatically over-the-air deployable to apps integrating WhisperKit such as our example app [WhisperAX on TestFlight](https://testflight.apple.com/join/LPVOyJZW). If you would like to publish custom Whisper versions that are not already published, you can do so as follows:\n- **Step 1**: Find the user or organization name that you have write access to on [Hugging Face Hub](https://huggingface.co/settings/profile). If you are logged into `huggingface-cli` locally, you may simply do:\n```shell\nhuggingface-cli whoami\n```\n\nIf you don't have a write token yet, you can generate it [here](https://huggingface.co/settings/tokens).\n\n- **Step 2**: Point to the model repository that you would like to publish to, e.g. `my-org/my-whisper-repo-name`, with the `MODEL_REPO_ID` environment variable and specify the name of the source PyTorch Whisper repository (e.g. [distil-whisper/distil-small.en](https://huggingface.co/distil-whisper/distil-small.en))\n```shell\nMODEL_REPO_ID=my-org/my-whisper-repo-name whisperkit-generate-model --model-version distil-whisper/distil-small.en --output-dir \u003coutput-dir\u003e\n```\n\nIf the above command is successfuly executed, your model will have been published to `hf.co/my-org/my-whisper-repo-name/distil-whisper_distil-small.en`!\n\n\n## \u003ca name=\"model-generation-android\"\u003e\u003c/a\u003e Model Generation (Android)\nWhisperKit currently only supports Qualcomm AI Hub Whisper models on Hugging Face:\n- [tiny.en](https://huggingface.co/qualcomm/Whisper-Tiny-En)\n- [base.en](https://huggingface.co/qualcomm/Whisper-Base-En)\n- [small.en](https://huggingface.co/qualcomm/Whisper-Small-En)\n\nwhisperkittools generates 3 more support models for input preprocessing and output postprocessing used in the WhisperKitAndroid pipeline. These are all published on Hugging Face [here](https://huggingface.co/argmaxinc/whisperkit-android/tree/main). Nonetheless, you may regenerate these models if you wish by following these steps:\n- **Step 1**: Create an account at [aihub.qualcomm.com](aihub.qualcomm.com)\n- **Step 2**: Set your API key locally as `qai-hub configure --api_token`\n- **Step 3**: Install extra dependencies via `pip install -e '.[android]'` (Note that this requires `python\u003c3.11`)\n- **Step 4**: Execute `python tests/test_aihub.py --persistent-cache-dir \u003coutput-path\u003e`\n\nStay tuned for more options for generating models without creating an account and more model version coverage!\n\n## \u003ca name=\"evaluate-apple\"\u003e\u003c/a\u003e Model Evaluation (Apple)\n\nEvaluate ([Argmax-](https://huggingface.co/argmaxinc/whisperkit-coreml) or developer-published) models on speech recognition datasets:\n\n```shell\nwhisperkit-evaluate-model --model-version \u003cmodel-version\u003e --output-dir \u003coutput-dir\u003e --evaluation-dataset {librispeech-debug,librispeech,earnings22}\n```\n\nInstall additional dependencies via:\n```shell\npip install -e '.[evals,pipelines]'\n```\n\nBy default, this command uses the latest `main` branch commits from `WhisperKit` and searches within [Argmax-published](https://huggingface.co/argmaxinc/whisperkit-coreml) model repositories. For optional arguments related to code and model versioning, please see the help menu with `-h`\n\nWe continually publish the evaluation results of Argmax-hosted models [here](https://huggingface.co/datasets/argmaxinc/whisperkit-evals) as part of our continuous integration tests.\n\n### \u003ca name=\"evaluate-on-custom-dataset\"\u003e\u003c/a\u003e Model Evaluation on Custom Dataset\nIf you would like to evaluate WhisperKit models on your own dataset:\n- **Step 1**: Publish a dataset on the [Hub](https://huggingface.co/new-dataset) with the same simple structure as this [toy dataset](https://huggingface.co/datasets/argmaxinc/librispeech-debug) (audio files + `metadata.json`)\n- **Step 2:** Run evaluation with environment variables as follows:\n\n```shell\nexport CUSTOM_EVAL_DATASET=\"my-dataset-name-on-hub\"\nexport DATASET_REPO_OWNER=\"my-user-or-org-name-on-hub\"\nexport MODEL_REPO_ID=\"my-org/my-whisper-repo-name\" # if evaluating self-published models\nwhisperkit-evaluate-model --model-version \u003cmodel-version\u003e --output-dir \u003coutput-dir\u003e --evaluation-dataset my-dataset-name-on-hub\n```\n\n## Python Inference\n\nUse the unified Python wrapper for several on-device Whisper frameworks:\n- [WhisperKit](https://github.com/argmaxinc/whisperkit)\n- [whisper.cpp](https://github.com/ggerganov/whisper.cpp)\n- [mlx-examples/whisper](https://github.com/ml-explore/mlx-examples/tree/main/whisper)\n- [WhisperOpenAIAPI (Server-side)](https://platform.openai.com/docs/guides/speech-to-text)\n\nInstall additional dependencies via:\n```shell\npip install -e '.[pipelines]'\n```\n\n```python\nfrom whisperkit.pipelines import WhisperKit, WhisperCpp, WhisperMLX, WhisperOpenAIAPI\n\npipe = WhisperKit(whisper_version=\"openai/whisper-large-v3\", out_dir=\"/path/to/out/dir\")\nprint(pipe(\"audio.{wav,flac,mp3}\"))\n```\n\n**Note:** `WhisperCpp` requires `ffmpeg` to be installed. Recommended installation is with `brew install ffmpeg`\n**Note:** `WhisperOpenAIAPI` requires setting `OPENAI_API_KEY` as an environment variable\n\n## Example SwiftUI App\n[TestFlight](https://testflight.apple.com/join/LPVOyJZW)\n\n[Source Code (MIT License)](https://github.com/argmaxinc/whisperkit/tree/main/Examples/WhisperAX)\n\nThis app serves two purposes:\n- Base template for developers to freely customize and integrate parts into their own app\n- Real-world testing/debugging utility for custom Whisper versions or WhisperKit features before/without building an app.\n\nNote that the app is in beta and we are actively seeking feedback to improve it before widely distributing it.\n\n## \u003ca name=\"qoi\"\u003e\u003c/a\u003e WhisperKit Quality and Performance Benchmarks\n\nPlease visit the [WhisperKit Benchmarks](https://huggingface.co/spaces/argmaxinc/whisperkit-benchmarks) Hugging Face Space for detailed benchmark results. Here is a [brief explanation](https://x.com/argmaxinc/status/1851723587423756680) to help with navigation of the results. This benchmark is updated for every non-patch release on virtually all supported devices.\n\n\n## FAQ\n\n**Q1**: `xcrun: error: unable to find utility \"coremlcompiler\", not a developer tool or in PATH`\n**A1**: Ensure Xcode is installed on your Mac and run `sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer`.\n\n\n## Citation\nIf you use WhisperKit for something cool or just find it useful, please drop us a note at [info@argmaxinc.com](mailto:info@argmaxinc.com)!\n\nIf you use WhisperKit for academic work, here is the BibTeX:\n\n```\n@misc{whisperkit-argmax,\ntitle = {WhisperKit},\nauthor = {Argmax, Inc.},\nyear = {2024},\nURL = {https://github.com/argmaxinc/WhisperKit}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargmaxinc%2Fwhisperkittools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fargmaxinc%2Fwhisperkittools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fargmaxinc%2Fwhisperkittools/lists"}