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 a whisper example using Intel Neural Compressor #412

Merged
merged 6 commits into from
Jul 14, 2023

Conversation

yuwenzho
Copy link
Contributor

Describe your changes

Add a whisper example using Intel® Neural Compressor Quantization.

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Format your code by running pre-commit run --all-files
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

@@ -4,6 +4,7 @@ This folder contains a sample use case of Olive to optimize a [Whisper](https://
Performs optimization pipeline:
- CPU, FP32: *PyTorch Model -> Onnx Model -> Transformers Optimized Onnx Model -> Insert Beam Search Op -> Insert Pre/Post Processing Ops*
- CPU, INT8: *PyTorch Model -> Onnx Model -> Transformers Optimized Onnx Model -> Dynamic Quantized Onnx Model -> Insert Beam Search Op -> Insert Pre/Post Processing Ops*
- CPU, INT8: *PyTorch Model -> Onnx Model -> Transformers Optimized Onnx Model -> Intel® Neural Compressor Dynamic Quantized Onnx Model -> Insert Beam Search Op -> Insert Pre/Post Processing Ops*
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to tell user to install olive-ai[inc] if they run this optimization chain.

IIRC, whisper is in our CI pipeline, you may need to add neural-compressor into whisper requirements.txt.

@trajepl
Copy link
Contributor

trajepl commented Jul 12, 2023

/azp run

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 412 in repo microsoft/Olive

@trajepl
Copy link
Contributor

trajepl commented Jul 12, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

trajepl
trajepl previously approved these changes Jul 13, 2023
@trajepl trajepl self-requested a review July 13, 2023 04:28
@trajepl trajepl dismissed their stale review July 13, 2023 04:28

Need changes.

@trajepl
Copy link
Contributor

trajepl commented Jul 13, 2023

image
Looks like the test for inc did not be triggered. You may need to update test_whisper.py

@yuwenzho yuwenzho force-pushed the yuwenzho/inc_whisper_example branch from 955395a to f2fefec Compare July 13, 2023 06:35
@trajepl
Copy link
Contributor

trajepl commented Jul 13, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@yuwenzho
Copy link
Contributor Author

@trajepl It seems that the example test of whisper inc is hanging on Windows. You mentioned in a previous PR that neural_compressor related imports are hanging for some reason on the CI pipeline agent. Is this the same issue here? Do you have any suggestions?

@trajepl
Copy link
Contributor

trajepl commented Jul 13, 2023

@trajepl It seems that the example test of whisper inc is hanging on Windows. You mentioned in a previous PR that neural_compressor related imports are hanging for some reason on the CI pipeline agent. Is this the same issue here? Do you have any suggestions?

Oh, yes, we can skip the inc_int8 test on windows. Please add follow code snipped under def test_whisper(device_precision):

    import platform

    if platform.system() == "Windows" and device_precision[1].startswith("inc_"):
        pytest.skip("Skip test on Windows. neural-compressor import is hanging on Windows.")

@@ -29,7 +29,7 @@ def setup():
sys.path.remove(example_dir)


@pytest.mark.parametrize("device_precision", [("cpu", "fp32"), ("cpu", "int8")])
@pytest.mark.parametrize("device_precision", [("cpu", "fp32"), ("cpu", "int8"), ("cpu", "inc_int8")])
def test_whisper(device_precision):
from olive.workflows import run as olive_run
Copy link
Contributor

@trajepl trajepl Jul 13, 2023

Choose a reason for hiding this comment

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

To skip test on windows.

    import platform

    if platform.system() == "Windows" and device_precision[1].startswith("inc_"):
        pytest.skip("Skip test on Windows. neural-compressor import is hanging on Windows.")

yuwenzho added 2 commits July 13, 2023 16:14
Signed-off-by: yuwenzho <[email protected]>
@trajepl
Copy link
Contributor

trajepl commented Jul 13, 2023

/azp run

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 412 in repo microsoft/Olive

@trajepl
Copy link
Contributor

trajepl commented Jul 13, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@trajepl trajepl merged commit fe6e3da into microsoft:main Jul 14, 2023
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.

2 participants