Skip to content

KeyError: <QuantScheme.post_training_tf_enhanced: 2> #3735

@ziFan99

Description

@ziFan99

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions