ValueError: ('Unrecognized keyword arguments:', dict_keys(['ragged']))

因为老版keras的tf.keras.Input不支持ragged参数,

修改 python安装目录\Lib\site-packages\tensorflow\python\keras\engine\input_layer.py文件,如下:

def __init__(self,
             input_shape=None,
             batch_size=None,
             dtype=None,
             input_tensor=None,
             sparse=False,
             name=None,
             **kwargs):
  if 'batch_input_shape' in kwargs:
    batch_input_shape = kwargs.pop('batch_input_shape')
    if input_shape and batch_input_shape:
      raise ValueError('Only provide the input_shape OR '
                       'batch_input_shape argument to '
                       'InputLayer, not both at the same time.')
    batch_size = batch_input_shape[0]
    input_shape = batch_input_shape[1:]
  # NOTE 注释这里:
  # if kwargs:
  #   raise ValueError('Unrecognized keyword arguments:', kwargs.keys())

感谢:
https://zhen8838.github.io/2020/03/18/h5-to-pb/