# Wav2vec2 for long audiofiles

**URL:** <https://discuss.huggingface.co/t/wav2vec2-for-long-audiofiles/6446>\
**Category:** Beginners\
**Created:** [May 28, 2021, 1:23pm UTC](https://discuss.huggingface.co/t/wav2vec2-for-long-audiofiles/6446 "2021-05-28T13:23:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladi315](https://avatars.discourse-cdn.com/v4/letter/v/d07c76/32.png) [@vladi315](https://discuss.huggingface.co/u/vladi315)\
**Post date:** [May 28, 2021, 1:23pm UTC](https://discuss.huggingface.co/t/wav2vec2-for-long-audiofiles/6446/1 "2021-05-28T13:23:27Z")

</div>

Hi,

I’m trying to apply wave2vec2 models on long audiofiles (~1h) for speech to text.  
However processing the entire audio file at once is not feasible because it requires more than 16GB. How can I import a sound file as audio stream into the wave2vec models?

---

<div class="post-metadata">

**Author:** ![constantinSch](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/constantinsch/32/27634_2.png) [@constantinSch](https://discuss.huggingface.co/u/constantinSch)\
**Post date:** [June 2, 2021, 11:18am UTC](https://discuss.huggingface.co/t/wav2vec2-for-long-audiofiles/6446/2 "2021-06-02T11:18:38Z")

</div>

Here is one way to do this with `librosa.stream`:

[https://github.com/huggingface/transformers/issues/10366#issuecomment-786780983](https://github.com/huggingface/transformers/issues/10366#issuecomment-786780983)

---

<div class="post-metadata">

**Author:** ![patrickvonplaten](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/patrickvonplaten/32/2171_2.png) [@patrickvonplaten](https://discuss.huggingface.co/u/patrickvonplaten)\
**Post date:** [March 18, 2022, 4:38pm UTC](https://discuss.huggingface.co/t/wav2vec2-for-long-audiofiles/6446/3 "2022-03-18T16:38:21Z")

</div>

This should actually now be extremely easy with the new chunking feature.

This blog post should help: [Making automatic speech recognition work on large files with Wav2Vec2 in 🤗 Transformers](https://huggingface.co/blog/asr-chunking)
