Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

AttributeError: 'TFLiteConverter' object has no attribute 'mlir' #192

Open
nassimus26 opened this issue Oct 18, 2024 · 1 comment
Open

Comments

@nassimus26
Copy link

I am using the laast version to convert a TF LITE model :

root@3c4673a43108:/home/mac/data# ./convert.sh
1.### convert to mlir
2024/10/19 05:19:44 - INFO : TPU-MLIR v1.11-20240927
2024/10/19 05:19:44 - INFO : 
         _____________________________________________________ 
        | preprocess:                                           |
        |   (x - mean) * scale                                  |
        '-------------------------------------------------------'
  config Preprocess args : 
        resize_dims           : same to net input dims
        keep_aspect_ratio     : True
        keep_ratio_mode       : letterbox
        pad_value             : 0
        pad_type              : center
        --------------------------
        mean                  : [0.0, 0.0, 0.0]
        scale                 : [1.0, 1.0, 1.0]
        --------------------------
        pixel_format          : rgb
        channel_format        : nhwc

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/tools/model_transform.py", line 406, in <module>
    tool = get_model_transform(args)
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/tools/model_transform.py", line 320, in get_model_transform
    tool = TFLiteTransformer(args.model_name, args.model_def, args.input_shapes,
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/tools/model_transform.py", line 202, in __init__
    self.converter = TFLiteConverter(self.model_name, self.model_def, input_shapes,
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/transform/TFLiteConverter.py", line 244, in __init__
    self.shape_infer = self.__shape_infer(input_shapes)
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/transform/TFLiteConverter.py", line 456, in __shape_infer
    tfi.reshape(**inputs)
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/transform/TFLiteInterpreter.py", line 47, in reshape
    self.allocate_tensors()
  File "/usr/local/lib/python3.10/dist-packages/tensorflow/lite/python/interpreter.py", line 531, in allocate_tensors
    return self._interpreter.AllocateTensors()
RuntimeError: tensorflow/lite/kernels/conv.cc:352 input_channel % filter_input_channel != 0 (2 != 0)Node number 13 (CONV_2D) failed to prepare.
Exception ignored in: <function TFLiteConverter.__del__ at 0x775994a35630>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/transform/TFLiteConverter.py", line 330, in __del__
    if self.mlir != None:
AttributeError: 'TFLiteConverter' object has no attribute 'mlir'

@lordrebel
Copy link

i think AttributeError: 'TFLiteConverter' object has no attribute 'mlir' not the root cause, check the traceback carefully, you can see there is a runtime error in shape infer:

 File "/usr/local/lib/python3.10/dist-packages/tpu_mlir/python/transform/TFLiteConverter.py", line 244, in __init__
    self.shape_infer = self.__shape_infer(input_shapes)

that makes the instance of TFLiteConverter fail to create

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

No branches or pull requests

2 participants