Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update VitisAIQuantization to use Quark#1715

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
vortex-captain wants to merge29 commits intomicrosoft:main
base:main
Choose a base branch
Loading
fromvortex-captain:reny/add_quark

Conversation

vortex-captain
Copy link

@vortex-captainvortex-captain commentedMar 27, 2025
edited by chinazhangchao
Loading

Description

Example usage in Olive workflow json:

"passes": {"conversion": {"device":"cpu","type":"OnnxConversion","target_opset":17,"use_dynamo_exporter":false    },"to_fixed_shape": {"type":"DynamicToFixedShape","dim_param": ["batch_size","sequence_length"],"dim_value": [1,77]    },"quantization": {"type":"QuarkQuantization","data_config":"calib_data","config_template":"XINT8","enable_npu_transformer":true,"extra_options": {"OpTypesToExcludeOutputQuantization": ["MatMul","Gemm"],"ActivationSymmetric":true      },"debug_mode":true,"log_severity_level":0,"ignore_warnings":false    }  }

Please refer tohttps://quark.docs.amd.com/latest/onnx/user_guide_config_description.html for the complete list ofconfig_template options. All the other quantization options are listed inhttps://quark.docs.amd.com/latest/onnx/appendix_full_quant_config_features.html .

Examples

2 ResNet examples are added toexamples/vai, which convert the models using Quark then evaluate onVitisAIExecutionProvider (run on NPU, RyzenAI 1.3.1, onnxruntime-vitisai 1.19).

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by runninglintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to updateexample documentation in a follow-up PR.

(Optional) Issue link

@vortex-captainvortex-captain marked this pull request as ready for reviewMarch 27, 2025 05:56
Copy link
Contributor

@github-advanced-securitygithub-advanced-securitybot left a comment

Choose a reason for hiding this comment

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

lintrunner found more than 20 potential problems in the proposed changes. Check theFiles changed tab for more details.

@ChaoLi-AMD
Copy link
Contributor

Describe your changes

Example usage in Olive workflow json:

"passes": {"conversion": {"device":"cpu","type":"OnnxConversion","target_opset":17,"use_dynamo_exporter":false    },"quantization": {"type":"VitisAIQuantization","data_config":"calib_data","config_template":"INT8_TRANSFORMER_ACCURATE","extra_options": {"OpTypesToExcludeOutputQuantization": ["MatMul","Gemm"],"ActivationSymmetric":true      },"debug_mode":true,"log_severity_level":0,"ignore_warnings":false    }  }

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by runninglintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to updateexample documentation in a follow-up PR.

(Optional) Issue link

please improve the example to refer to Quark documentation:https://quark.docs.amd.com/latest/supported_accelerators/ryzenai/index.html

vortex-captain reacted with thumbs up emoji

@xiaoyu-work
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -40,6 +40,7 @@ class CacheSubDirs:
evaluations: Path
resources: Path
mlflow: Path
vitis_ai: Path
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain more about how will you use this folder? The cache folder is designed to be pass-agnostic so i want to double confirm the use case here.

Choose a reason for hiding this comment

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

The folder will be created at the beginning of the evaluation step, upon the creation of a VitisAIExecutionProvider inference session (used as model cache by EP). Is evaluation considered an Olive pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, if VitisAIEP will need to cache a model for evaluation, can we create a temporal folder for it? (and it will be deleted after all. I assume this model cache is not needed when the workflow finish.). We can create a temporary folder in cache.evaluations like temp_model_cache or something.

@shaahji
Copy link
Contributor

Update the entry inolive_config.json to point to the correct location of the pass implementation in the module. Many of the tests are failing because of the wrong entry.

vortex-captain reacted with thumbs up emoji

@vortex-captain
Copy link
Author

Describe your changes

Example usage in Olive workflow json:

"passes": {"conversion": {"device":"cpu","type":"OnnxConversion","target_opset":17,"use_dynamo_exporter":false    },"quantization": {"type":"VitisAIQuantization","data_config":"calib_data","config_template":"INT8_TRANSFORMER_ACCURATE","extra_options": {"OpTypesToExcludeOutputQuantization": ["MatMul","Gemm"],"ActivationSymmetric":true      },"debug_mode":true,"log_severity_level":0,"ignore_warnings":false    }  }

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by runninglintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to updateexample documentation in a follow-up PR.

(Optional) Issue link

please improve the example to refer to Quark documentation:https://quark.docs.amd.com/latest/supported_accelerators/ryzenai/index.html

Added links of Quark documentation on quantization configurations

@vortex-captainvortex-captain requested review fromshaahji andChaoLi-AMD and removed request forChaoLi-AMDApril 17, 2025 07:31
@ChaoLi-AMD
Copy link
Contributor

Describe your changes

Example usage in Olive workflow json:

"passes": {"conversion": {"device":"cpu","type":"OnnxConversion","target_opset":17,"use_dynamo_exporter":false    },"quantization": {"type":"VitisAIQuantization","data_config":"calib_data","config_template":"INT8_TRANSFORMER_ACCURATE","extra_options": {"OpTypesToExcludeOutputQuantization": ["MatMul","Gemm"],"ActivationSymmetric":true      },"debug_mode":true,"log_severity_level":0,"ignore_warnings":false    }  }

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by runninglintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to updateexample documentation in a follow-up PR.

(Optional) Issue link

please improve the example to refer to Quark documentation:https://quark.docs.amd.com/latest/supported_accelerators/ryzenai/index.html

Added links of Quark documentation on quantization configurations

For a Ryzen AI example, please use XINT8 as the example instead of INT8_TRANSFORMER_ACCURATE. Just checking — does this example currently runnable on Olive?

@jambayk
Copy link
Contributor

@vortex-captain please create a copy of your branch directly in this repo and open a new PR to be able to run the CI without the login issue.

vortex-captain reacted with thumbs up emoji

@xiaoyu-workxiaoyu-work mentioned this pull requestApr 17, 2025
6 tasks
@vortex-captain
Copy link
Author

Describe your changes

Example usage in Olive workflow json:

"passes": {"conversion": {"device":"cpu","type":"OnnxConversion","target_opset":17,"use_dynamo_exporter":false    },"quantization": {"type":"VitisAIQuantization","data_config":"calib_data","config_template":"INT8_TRANSFORMER_ACCURATE","extra_options": {"OpTypesToExcludeOutputQuantization": ["MatMul","Gemm"],"ActivationSymmetric":true      },"debug_mode":true,"log_severity_level":0,"ignore_warnings":false    }  }

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by runninglintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.
  • Is this PR including examples changes? If yes, please remember to updateexample documentation in a follow-up PR.

(Optional) Issue link

please improve the example to refer to Quark documentation:https://quark.docs.amd.com/latest/supported_accelerators/ryzenai/index.html

Added links of Quark documentation on quantization configurations

For a Ryzen AI example, please use XINT8 as the example instead of INT8_TRANSFORMER_ACCURATE. Just checking — does this example currently runnable on Olive?

Updated example in description. And yes, such an example (BERT text model) is runnable on Olive, but in evaluation, the output model cannot run on NPU (all nodes assigned to CPU), unlike the ResNet examples. Any insights?

Comment on lines +157 to +163
elif provider == "VitisAIExecutionProvider":
import os

apu_type = get_vai_apu_type()
set_vai_environment_variable(apu_type)
install_dir = Path(os.environ["RYZEN_AI_INSTALLATION_PATH"])
provider_options[idx]["config_file"] = str(install_dir / "voe-4.0-win_amd64" / "vaip_config.json")
Copy link
Contributor

@VishalXVishalXMay 7, 2025
edited
Loading

Choose a reason for hiding this comment

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

This is adding dependency to a specific version. I don't think we should add this here.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@chinazhangchaochinazhangchaochinazhangchao left review comments

@gengxinwugengxinwugengxinwu left review comments

@jambaykjambaykjambayk left review comments

@ChaoLi-AMDChaoLi-AMDChaoLi-AMD left review comments

@VishalXVishalXVishalX requested changes

@xiaoyu-workxiaoyu-workAwaiting requested review from xiaoyu-work

@shaahjishaahjiAwaiting requested review from shaahji

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

8 participants
@vortex-captain@ChaoLi-AMD@xiaoyu-work@shaahji@jambayk@chinazhangchao@gengxinwu@VishalX

[8]ページ先頭

©2009-2025 Movatter.jp