Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions CNN-examples/quark_quantization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ cache_dir = Path(__file__).parent.resolve()
print(cache_dir)
provider_options = [{
'config_file': 'vaip_config.json',
'cacheDir': str(cache_dir),
'cacheKey': 'modelcachekey'
'cache_dir': str(cache_dir),
'cache_key': 'modelcachekey'
}]

session = ort.InferenceSession(quant_model.SerializeToString(), providers=provider,
Expand Down Expand Up @@ -234,4 +234,3 @@ Advancted Quantization Tools
----------------------------

While the default quantization configurations work well for many popular models, more sophisticated models might experience a decline in accuracy due to errors introduced during the quantization process. To address this, Quark APIs offer advanced tools to help recover lost accuracy. Some of these tools are highlighted in the [Advanced Quantization Tools](../docs/advanced_quant_readme.md) tutorial.

9 changes: 5 additions & 4 deletions CNN-examples/quark_quantization/quark_quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,17 @@ def main(args):
provider = ['VitisAIExecutionProvider']
cache_dir = Path(__file__).parent.resolve()
provider_options = [{
'cacheDir': str(cache_dir),
'cacheKey': 'modelcachekey',
'enable_cache_file_io_in_mem':'0'
}]
'cache_dir': str(cache_dir),
'cache_key': 'modelcachekey',
'enable_cache_file_io_in_mem': '0'
}]
# Create session options
session_options = ort.SessionOptions()
session_options.log_severity_level = 1 # 0=Verbose, 1=Info, 2=Warning, 3=Error, 4=Fatal
# For PHX/HPT, xclbin is required
if npu_device == 'PHX/HPT':
provider_options[0]['target'] = 'X1'
provider_options[0]['xlnx_enable_py3_round'] = 0
provider_options[0]['xclbin'] = get_xclbin(npu_device)
session = ort.InferenceSession(quant_model.SerializeToString(),
sess_options=session_options,
Expand Down