Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

KeyError: <QuantScheme.post_training_tf_enhanced: 2> #3735

Open
ziFan99 opened this issue Jan 17, 2025 · 0 comments
Open

KeyError: <QuantScheme.post_training_tf_enhanced: 2> #3735

ziFan99 opened this issue Jan 17, 2025 · 0 comments

Comments

@ziFan99
Copy link

ziFan99 commented Jan 17, 2025

When running the following code:

I encountered the error KeyError: <QuantScheme.post_training_tf_enhanced: 2>. I have checked /root/autodl-tmp/aimet-1.32.0/TrainingExtensions/common/src/python/aimet_common/defs.py, and the code contains the corresponding QuantScheme.post_training_tf_enhanced. Why is this error still occurring?
`import onnx
from TrainingExtensions.onnx.src.python.aimet_onnx.batch_norm_fold import fold_all_batch_norms_to_weight
from TrainingExtensions.common.src.python.aimet_common.defs import QuantScheme
from TrainingExtensions.onnx.src.python.aimet_onnx.quantsim import QuantizationSimModel
from TrainingExtensions.onnx.src.python.aimet_onnx.cross_layer_equalization import equalize_model

import numpy as np
import onnxruntime as ort

filename = "/root/autodl-tmp/aimet-1.32.0/onnx/rec_mv3_none_bilstm_ctc_crnn_32X100.onnx"

model = onnx.load_model(filename)

dummy_input = {"x": np.random.randn(1, 3, 32, 100).astype(np.float32)}
_ = fold_all_batch_norms_to_weight(model)

sim = QuantizationSimModel(
model=model,
quant_scheme=QuantScheme.post_training_tf_enhanced,
default_activation_bw=8,
default_param_bw=8,
dummy_input=dummy_input,
use_cuda=True
)`
I encountered the error KeyError: <QuantScheme.post_training_tf_enhanced: 2>.
I have checked TrainingExtensions/common/src/python/aimet_common/defs.py, and the code contains the corresponding QuantScheme.post_training_tf_enhanced. Why is this error still occurring?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant