-
Notifications
You must be signed in to change notification settings - Fork 28
add aitk whisper sample (step 1); check dataset #209
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e26b51b
add init script
5be97ba
fix up
cd9eb90
format
78a21ef
add user_script
097e719
add qnn pythons
f4172a7
add configs
e87daff
add req
8201ffa
fix datasets
b23212a
fixes
639f90c
update logger
8db23d9
add evaluation
bbdf2eb
fix
067213c
reorder
03090f8
fix
d45e1d0
Update openai-whisper-large-v3-turbo/aitk/whisper_decoder_load.py
xieofxie f1b326e
Update openai-whisper-large-v3-turbo/aitk/whisper_encoder_load.py
xieofxie 5f90dce
update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,16 @@ | ||
| { | ||
| "configCheck": 127, | ||
| "configCheck": 128, | ||
| "copyCheck": 182, | ||
| "extensionCheck": 1, | ||
| "gitignoreCheck": 37, | ||
| "gitignoreCheck": 38, | ||
| "inferenceModelCheck": 25, | ||
| "ipynbCheck": 37, | ||
| "licenseCheck": 36, | ||
| "modelProjectCheck": 38, | ||
| "ipynbCheck": 38, | ||
| "licenseCheck": 37, | ||
| "modelProjectCheck": 39, | ||
| "oliveCheck": 36, | ||
| "oliveJsonCheck": 127, | ||
| "pathCheck": 992, | ||
| "oliveJsonCheck": 128, | ||
| "pathCheck": 1005, | ||
| "requirementsCheck": 37, | ||
| "templateCheck": 1, | ||
| "venvRequirementsCheck": 10 | ||
| "venvRequirementsCheck": 11 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| gdown==5.2.0 | ||
| gitpython==3.1.46 | ||
| librosa==0.11.0 | ||
| qai_hub==0.42.0 | ||
| ruamel-yaml==0.19.1 | ||
| schema==0.7.8 | ||
| sounddevice==0.5.2 | ||
| # need to install without deps because it depends on onnxruntime | ||
| # uv pip:install qai_hub_models==0.39.1 --no-deps;post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| __pycache__ | ||
| /cache | ||
| /history/*/* | ||
| !/history/*/history.config | ||
| !/history/*/olive_config.json | ||
| /data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| ## Whisper-large-v3-turbo Optimization with ONNX Runtime QNN EP | ||
|
|
||
| This folder outlines the process for optimizing the Whisper-large-v3-turbo model using ONNX Runtime with the QNN Execution Provider. It includes steps for exporting FP32 models, generating representative data for static quantization, creating QDQ models, model evaluation and performing audio transcription using the optimized models. | ||
|
|
||
| ### Generate data for static quantization | ||
|
|
||
| To get better results, we need to generate real data from original FP32 model instead of using random data for static quantization. Here we use 100 samples of librispeech dataset to generate the required real data which requires around 164 GB of disk space. | ||
|
|
||
| First generate FP32 onnx models: | ||
|
|
||
| 1. Encoder FP32 model | ||
|
|
||
| `olive run --config whisper_large_v3_turbo_encoder_fp32.json` | ||
| 1. Decoder FP32 model | ||
|
|
||
| `olive run --config whisper_large_v3_turbo_decoder_fp32.json` | ||
|
|
||
| Then download and generate data: | ||
|
|
||
| 1. `python .\qnn_run.py --audio-path .\data\librispeech_asr_clean_test --encoder "models\whisper_encoder_fp32\model\model.onnx" --decoder "models\whisper_decoder_fp32\model.onnx" --model_id "openai/whisper-large-v3-turbo" --save_data .\data\quantization_data --num_data 100` | ||
|
|
||
| ### Generate QDQ models | ||
|
|
||
| 1. `olive run --config whisper_large_v3_turbo_encoder_qdq.json` | ||
| 2. `olive run --config whisper_large_v3_turbo_decoder_qdq.json` | ||
|
|
||
| (Optional) Use whisper_large_v3_turbo_encoder_qdq_ctx.json and whisper_large_v3_turbo_decoder_qdq_ctx.json to create onnx models with QNN context binaries embedded in them. | ||
|
|
||
| ### To transcribe a single sample: | ||
|
|
||
| `python .\qnn_run.py --audio-path .\data\librispeech_asr_clean_test\1320-122617-0000.npy --encoder "models\whisper_encoder_qdq\model.onnx" --decoder "models\whisper_decoder_qdq\model.onnx" --model_id "openai/whisper-large-v3-turbo" --execution_provider QNNExecutionProvider` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "eed9c231", | ||
| "metadata": { | ||
| "vscode": { | ||
| "languageId": "plaintext" | ||
| } | ||
| }, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# TODO\n", | ||
| "ExecutionProvider=\"QNNExecutionProvider\"" | ||
xieofxie marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "language_info": { | ||
| "name": "python" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| keywords: | ||
| aitk | ||
| arch: whisper | ||
| recipes: | ||
| - file: "qnn_workflow.json" | ||
| device: npu | ||
| ep: QNNExecutionProvider | ||
| aitk: | ||
| modelInfo: | ||
| id: "huggingface/openai/whisper-large-v3-turbo" | ||
| version: 1 | ||
| status: Hide |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "workflows": [ | ||
| { | ||
| "file": "qnn_workflow.json", | ||
| "templateName": "qnn_workflow" | ||
| } | ||
| ], | ||
| "modelInfo": { | ||
| "id": "huggingface/openai/whisper-large-v3-turbo", | ||
| "version": 1 | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.