cc-hpc-itwm / TensorQuant

Apache License 2.0
47 stars 11 forks source link

fcnet attribute error on runtime : 'unicode' object has no attribute 'quantize' #1

Closed kmonachopoulos closed 6 years ago

kmonachopoulos commented 6 years ago

Hello,

I have managed to train fcnet on mnist and extract the .ckpt, .meta , .data files and the 'checkpoint' file that contains the name of the .ckpt.

I am executing ./scripts/infer_fcnet.sh with the argument --intr_qmap=path-to-.json file. The .json file contains the quantization map :

{
    "FCNet" : "nearest,8,4"
}

So I chose to quantize the fcn operation in the specific fixed point representation. The .json file is loaded correctly from :

intr_q_map=utils.quantizer_map('qMap_filename')

but I get an error on runtime :

INFO:tensorflow:Scale of 0 disables regularizer.
INFO:tensorflow:Quantizing (intr) layer FCNet/logits
Traceback (most recent call last):
  File "eval_image_classifier.py", line 277, in <module>
    tf.app.run()
  File "/home/xxxxx/virtual-tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "eval_image_classifier.py", line 186, in main
    logits, endpoints = network_fn(images)
  File "/home/xxxxx/tensorflow/TensorQuant/slim/nets/nets_factory.py", line 144, in network_fn
    fully_connected=fully_connected)
  File "/home/xxxxx/tensorflow/TensorQuant/slim/nets/fcnet.py", line 36, in fcnet
    scope='logits')
  File "/home/xxxxx/tensorflow/TensorQuant/Quantize/Factories.py", line 49, in func
    net=q_layer_function(*args,**kwargs)
  File "/home/xxxxx/virtual-tensorflow/local/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 181, in func_with_args
    return func(*args, **current_args)
  File "/home/xxxxx/tensorflow/TensorQuant/Quantize/QFullyConnect.py", line 86, in fully_connected
    outputs = layer.apply(inputs)
  File "/home/xxxxx/virtual-tensorflow/local/lib/python2.7/site-packages/tensorflow/python/layers/base.py", line 503, in apply
    return self.__call__(inputs, *args, **kwargs)
  File "/home/xxxxx/virtual-tensorflow/local/lib/python2.7/site-packages/tensorflow/python/layers/base.py", line 450, in __call__
    outputs = self.call(inputs, *args, **kwargs)
  File "/home/xxxxx/tensorflow/TensorQuant/Quantize/QFullyConnect.py", line 153, in call
    used_kernel = self.quantizer.quantize(used_kernel)
AttributeError: 'unicode' object has no attribute 'quantize'

Any idea what the cause is?

kmonachopoulos commented 6 years ago

Closing ... the .json format should be different .