sophgo / tpu-mlir

Machine learning compiler based on MLIR for Sophgo TPU.
Other
612 stars 154 forks source link

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

Open nassimus26 opened 1 month ago

nassimus26 commented 1 month ago

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'