TensorSpeech / TensorFlowASR

:zap: TensorFlowASR: Almost State-of-the-art Automatic Speech Recognition in Tensorflow 2. Supported languages that can use characters or subwords
https://huylenguyen.com/asr
Apache License 2.0
938 stars 245 forks source link

Failed to load dataset with sentence_piece model. #208

Open kju196 opened 3 years ago

kju196 commented 3 years ago

I tried to train the model with sentence_piece Tensorflow 2.3.2 and cuda 10.1

python examples/deepspeech2/train.py --config config.yml --sentence_piece

But I got this error.

INFO:tensorflow:Reading /data/asr/train.tsv ...
Traceback (most recent call last):
  File "examples/deepspeech2/train.py", line 111, in <module>
    train_data_loader = train_dataset.create(global_batch_size)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow_asr/datasets/asr_dataset.py", line 368, in create
    dataset = tf.data.Dataset.from_tensor_slices(self.entries)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 682, in from_tensor_slices
    return TensorSliceDataset(tensors)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/data/ops/dataset_ops.py", line 3001, in __init__
    element = structure.normalize_element(element)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/data/util/structure.py", line 115, in normalize_element
    ops.convert_to_tensor(t, name="component_%d" % i))
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/ops.py", line 1499, in convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/tensor_conversion_registry.py", line 52, in _default_conversion_function
    return constant_op.constant(value, dtype, name=name)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 263, in constant
    return _constant_impl(value, dtype, shape, name, verify_shape=False,
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 275, in _constant_impl
    return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 300, in _constant_eager_impl
    t = convert_to_eager_tensor(value, ctx, dtype)
  File "/data/anaconda3/envs/asr/lib/python3.8/site-packages/tensorflow/python/framework/constant_op.py", line 98, in convert_to_eager_tensor
    return ops.EagerTensor(value, ctx.device_name, dtype)
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type list).

Could you give me a suggestion where I got a mistake?

vivekyadav21 commented 3 years ago

@kju196 add this tf.config.run_functions_eagerly(True) to your code to enable eager execution. may be this help you