Wav_filename = Path(row['wav_filename']). KeyError: 'wav_filename'

I am new in deepspeech and this is my first time training with deepspeech. I am facing a problem during trainging. running deepspeech.py gives the following error.

Epoch 0 | Training | Elapsed Time: 0:00:00 | Steps: 0 | Loss: 0.000000 Traceback (most recent call last):
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1365, in _do_call
return fn(*args)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1350, in _run_fn
target_list, run_metadata)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence
[[{{node tower_0/IteratorGetNext}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 572, in run_set
feed_dict=feed_dict)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 956, in run
run_metadata_ptr)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1180, in _run
feed_dict_tensor, options, run_metadata)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1359, in _do_run
run_metadata)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/client/session.py”, line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.OutOfRangeError: End of sequence
[[node tower_0/IteratorGetNext (defined at /home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for ‘tower_0/IteratorGetNext’:
File “DeepSpeech.py”, line 12, in
ds_train.run_script()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 982, in run_script
absl.app.run(main)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/absl/app.py”, line 303, in run
_run_main(main, args)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/absl/app.py”, line 251, in _run_main
sys.exit(main(argv))
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 954, in main
train()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 484, in train
gradients, loss, non_finite_files = get_tower_results(iterator, optimizer, dropout_rates)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 317, in get_tower_results
avg_loss, non_finite_files = calculate_mean_edit_distance_and_loss(iterator, dropout_rates, reuse=i > 0)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 236, in calculate_mean_edit_distance_and_loss
batch_filenames, (batch_x, batch_seq_len), batch_y = iterator.get_next()
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/data/ops/iterator_ops.py”, line 426, in get_next
name=name)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/ops/gen_dataset_ops.py”, line 2518, in iterator_get_next
output_shapes=output_shapes, name=name)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/framework/op_def_library.py”, line 794, in _apply_op_helper
op_def=op_def)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/util/deprecation.py”, line 507, in new_func
return func(*args, **kwargs)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py”, line 3357, in create_op
attrs, op_def, compute_device)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py”, line 3426, in _create_op_internal
op_def=op_def)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py”, line 1748, in init
self._traceback = tf_stack.extract_stack()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “DeepSpeech.py”, line 12, in
ds_train.run_script()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 982, in run_script
absl.app.run(main)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/absl/app.py”, line 303, in run
_run_main(main, args)
File “/home/apurba/PycharmProjects/pythonProject/venv/lib/python3.6/site-packages/absl/app.py”, line 251, in _run_main
sys.exit(main(argv))
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 954, in main
train()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 607, in train
train_loss, _ = run_set(‘train’, epoch, train_init_op)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/train.py”, line 575, in run_set
exception_box.raise_if_set()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/helpers.py”, line 149, in raise_if_set
raise exception # pylint: disable = raising-bad-type
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/helpers.py”, line 157, in do_iterate
yield from iterable()
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/feeding.py”, line 104, in generate_values
samples = samples_from_sources(sources, buffering=buffering, labeled=True, reverse=reverse)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/sample_collections.py”, line 622, in samples_from_sources
return samples_from_source(sample_sources[0], buffering=buffering, labeled=labeled, reverse=reverse)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/sample_collections.py”, line 584, in samples_from_source
return CSV(sample_source, labeled=labeled, reverse=reverse)
File “/home/apurba/PycharmProjects/pythonProject/DeepSpeech/training/deepspeech_training/util/sample_collections.py”, line 543, in init
wav_filename = Path(row[‘wav_filename’])
KeyError: ‘wav_filename’

I saw this. But the solution didn’t work for me.

my csv file looks like this

wav_filename,wav_filesize,transcript
./data/test/s19.wav,187154,এক নাম্বার পাখা চালু করা হোক
./data/test/s110.wav,189888,এক নাম্বার পাখা বন্ধ করা হোক

can someone please help in this regard

@lissyx I know this problem occurs when the csv file is saved in UTP-8 format and when deepspeech reads it the result will be: ('\ufeffwav_filename', 'wav_filesize', 'transcript') has the \ufeff part added so yes any way to deal with no

Did you already try with the first line (header row) removed from your CSV-file?

yes I tried. That didn’t help

feffis the Byte Order Mark, if it is the problem, you could try to save the file without BOM, using a text editor or e.g. iconv.