# Wav2vec2 finetuning custom dataset

**URL:** <https://discuss.huggingface.co/t/wav2vec2-finetuning-custom-dataset/8408>\
**Category:** 🤗Transformers\
**Created:** [July 16, 2021, 12:19am UTC](https://discuss.huggingface.co/t/wav2vec2-finetuning-custom-dataset/8408 "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](https://discuss.huggingface.co/u/Shiro)\
**Post date:** [July 16, 2021, 12:19am UTC](https://discuss.huggingface.co/t/wav2vec2-finetuning-custom-dataset/8408/1 "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](https://discuss.huggingface.co/u/theainerd)\
**Post date:** [July 28, 2021, 5:32am UTC](https://discuss.huggingface.co/t/wav2vec2-finetuning-custom-dataset/8408/2 "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](https://discuss.huggingface.co/u/rokayabn)\
**Post date:** [December 25, 2024, 8:30pm UTC](https://discuss.huggingface.co/t/wav2vec2-finetuning-custom-dataset/8408/3 "2024-12-25T20:30:14Z")

</div>

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