finetune_wav2vec2_xlsr_turkish.sh can not find wav
Author: Qoboty
Pull request: no

Hi @patrickvonplaten 

when using transformers/examples/research_projects/wav2vec2/finetune_wav2vec2_xlsr_turkish.sh
I got err:

 0%|          | 0/3478 [00:00<?, ?ex/s]formats: can't open input file `common_voice_tr_17346025.mp3': No such file or directory
  0%|          | 0/3478 [00:00<?, ?ex/s]
Traceback (most recent call last):
  File "run_common_voice.py", line 506, in <module>
    main()
  File "run_common_voice.py", line 394, in main
    train_dataset = train_dataset.map(
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 2018, in map
    return self._map_single(
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 518, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 485, in wrapper
    out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/datasets/fingerprint.py", line 411, in wrapper
    out = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 2368, in _map_single
    example = apply_function_on_filtered_inputs(example, i, offset=offset)
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 2277, in apply_function_on_filtered_inputs
    processed_inputs = function(*fn_args, *additional_args, **fn_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/datasets/arrow_dataset.py", line 1978, in decorated
    result = f(decorated_item, *args, **kwargs)
  File "run_common_voice.py", line 388, in speech_file_to_array_fn
    speech_array, sampling_rate = torchaudio.load(batch["path"])
  File "/usr/local/lib/python3.8/dist-packages/torchaudio/backend/sox_io_backend.py", line 152, in load
    return torch.ops.torchaudio.sox_io_load_audio_file(
RuntimeError: Error loading audio file: failed to open file.

Python version:3.8
 I find cached common_voice of tr in dir /root/.cache/huggingface/datasets/common_voice/tr/6.1.0/b879a355caa529b11f2249400b61cadd0d9433f334d5c60f8c7216ccedfecfe1/

<img width="752" alt="image" src="https://user-images.githubusercontent.com/21211666/146008927-7ba5284a-920d-4418-912f-366b5009f3ac.png">

I think I need not have to download mp3 file before, right? and  how to fix err? Thanks



Comments:
Hi @Qoboty! Sorry for the inconvenience, `common_voice` recently got upgraded to use `datasets.features.Audio` with archive streaming, so the older scripts in `research_projects/wav2vec2/` that used string audio paths no longer support it. 

Try running an experiment with this example, which is actively maintained to support the latest features: https://github.com/huggingface/transformers/tree/master/examples/pytorch/speech-recognition#single-gpu

@lhoestq should we maybe deprecate the use of `"path"` directly on the datasets side? We'll upgrade the older scripts of course, but I'm asking just in case there's a sure way to prevent this error from happening :) 

Also we don't actively maintain the `research_projects` anymore. @Qoboty in case it's possible for you it would be great if you could move to https://github.com/huggingface/transformers/blob/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py instead

> Try running an experiment with this example, which is actively maintained to support the latest features: https://github.com/huggingface/transformers/tree/master/examples/pytorch/speech-recognition#single-gpu

Cool, I will try it today, Thanks!


> Also we don't actively maintain the `research_projects` anymore. @Qoboty in case it's possible for you it would be great if you could move to https://github.com/huggingface/transformers/blob/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py instead

Thanks, I got the research_project link by "fine-tune-xlsr-wav2vec2" blog on "Set-up Trainer" chapter
https://huggingface.co/blog/fine-tune-xlsr-wav2vec2
so, we'd better make new link to https://github.com/huggingface/transformers/blob/master/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py in case  other gays got the same err,  Thanks
<img width="987" alt="image" src="https://user-images.githubusercontent.com/21211666/146108980-2dc33cdd-4950-4e4e-a6b3-ee8884d3a3f2.png">


Hey @Qoboty, 

Yes you're 100% correct. Thanks a lot for spotting this!

https://github.com/huggingface/blog/pull/187

> @lhoestq should we maybe deprecate the use of "path" directly on the datasets side? We'll upgrade the older scripts of course, but I'm asking just in case there's a sure way to prevent this error from happening :)

Yes indeed, we're discussing this in `datasets` (see first point at https://github.com/huggingface/datasets/pull/3430#issuecomment-994734828)

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.

@patrickvonplaten @anton-l 
hi there.
i already have this problem even with new example.
i got the same error the @Qoboty  had.
what should i do?

Hey @mehrdad78,

Could you provide us with a code snippet to reproduce this error?

> Hey @mehrdad78,
> 
> Could you provide us with a code snippet to reproduce this error?
Hi Patrick: 
#18379