neural-compressor icon indicating copy to clipboard operation
neural-compressor copied to clipboard

BUG: Unexpected exception TypeError("_post_eval_hook() got an unexpected keyword argument 'accuracy'") happened during tuning.

Open johnsGuo opened this issue 2 years ago • 2 comments

When I use tf2.5 with NIC, I want to use tensorboard, and my conf is

version: 1.0

model:                                               # mandatory. used to specify model specific information.
  name: origin_model
  framework: tensorflow                              # mandatory. supported values are tensorflow, pytorch, pytorch_ipex, onnxrt_integer, onnxrt_qlinear or mxnet; allow new framework backend extension.

quantization:                                        # optional. tuning constraints on model-wise for advance user to reduce tuning space.
  calibration:
    sampling_size: 10000                              # optional. default value is 100. used to set how many samples should be used in calibration.
  model_wise:                                        # optional. tuning constraints on model-wise for advance user to reduce tuning space.
    activation:
      algorithm: minmax
#  op_wise: {
#             'import/dnn/hiddenlayer_0/MatMul': {
#               'activation':  {'dtype': ['uint8'], 'algorithm': ['minmax'], 'scheme':['asym']},
#             }
#           }

tuning:
  tensorboard: true
  accuracy_criterion:
    relative:  0.01                                  # optional. default value is relative, other value is absolute. this example allows relative accuracy loss: 1%.
  exit_policy:
    timeout: 0                                       # optional. tuning timeout (seconds). default value is 0 which means early stop. combine with max_trials field to decide when to exit.
    max_trials: 100                                  # optional. max tune times. default value is 100. combine with timeout field to decide when to exit.
  random_seed: 9527  

Then I got this error, Is a Bug 2022-04-07 11:03:00 [ERROR] Unexpected exception TypeError("_post_eval_hook() got an unexpected keyword argument 'accuracy'") happened during tuning. Traceback (most recent call last): File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/neural_compressor/experimental/quantization.py", line 151, in execute self.strategy.traverse() File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/neural_compressor/strategy/strategy.py", line 323, in traverse self.baseline = self._evaluate(self.model) File "/root/anaconda3/envs/tf2/lib/python3.7/site-packages/neural_compressor/strategy/strategy.py", line 463, in _evaluate self.adaptor._post_eval_hook(model, accuracy=val[0])

johnsGuo avatar Apr 07 '22 03:04 johnsGuo

The tensorflow adaptor not has accuracy params, So raise the execption, You have pass it, So tensorboard in NIC is not avaliable now! image

johnsGuo avatar Apr 07 '22 03:04 johnsGuo

thanks for the feedback. we will take a look on that

ftian1 avatar Apr 18 '22 00:04 ftian1

Hi @GuoGuiRong,

Thank you for reporting the bug. It's fixed in our next release.

image

qgao007 avatar Sep 08 '22 02:09 qgao007