# Wav2vec2 finetuning custom dataset

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwav2vec2-finetuning-custom-dataset%2F8408%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 16, 2021, 12:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwav2vec2-finetuning-custom-dataset%2F8408 "2021-07-16T00:19:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shiro](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Shiro](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FShiro)%5C
**Post date:** [July 16, 2021, 12:19am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwav2vec2-finetuning-custom-dataset%2F8408%2F1 "2021-07-16T00:19:28Z")

</div>

Hello,

Thank you for sharing such nice model again on this framework.

I am trying to finetune a wav2vec2 model on a custom dataset (so not from the dataset package of huggingface). I have tried to follow these two tutorials :

- [Fine-Tune Wav2Vec2 for English ASR in Hugging Face with 🤗 Transformers](https://huggingface.co/blog/fine-tune-wav2vec2-english)
- [Fine-tuning with custom datasets — transformers 4.7.0 documentation](https://huggingface.co/transformers/custom_datasets.html)  
but I did not find how to use multiprocessing when using trainer on a custom dataset ? Should I use dataloader class from torch ? For now I am using the regular Dataset class from torch.

I also encoutered memory issue with the GPU (16 gb) with a base Wav2vec2 model, even with batch size = 1. What is the maximum batch size for a base and large model for 16 gb, and with what length of sample ? (using fp16).

I thank you for the help

---

<div class="post-metadata">

**Author:** ![theainerd](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/theainerd/32/38982_2.png) [@theainerd](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Ftheainerd)%5C
**Post date:** [July 28, 2021, 5:32am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwav2vec2-finetuning-custom-dataset%2F8408%2F2 "2021-07-28T05:32:21Z")

</div>

You can convert your custom dataset if its a dataframe into Hugging Face format using this.

```python
from datasets import Dataset, load_metric

train_data = Dataset.from_pandas(train_df)
test_data = Dataset.from_pandas(test_df)

```

If you are facing memory related problem, set num\_proc = 1  
It solved my problem.

---

<div class="post-metadata">

**Author:** ![rokayabn](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rokayabn](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frokayabn)%5C
**Post date:** [December 25, 2024, 8:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwav2vec2-finetuning-custom-dataset%2F8408%2F3 "2024-12-25T20:30:14Z")

</div>

hello i want to finetune that model but on arabic tartil dataset what changes should i do ?
