# Wav2Vec2 Processor padding strategy

**URL:** <https://discuss.huggingface.co/t/wav2vec2-processor-padding-strategy/64975>\
**Category:** 🤗Transformers\
**Created:** [December 7, 2023, 7:22pm UTC](https://discuss.huggingface.co/t/wav2vec2-processor-padding-strategy/64975 "2023-12-07T19:22:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![menevsem](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/menevsem/32/50697_2.png) [@menevsem](https://discuss.huggingface.co/u/menevsem)\
**Post date:** [December 7, 2023, 7:22pm UTC](https://discuss.huggingface.co/t/wav2vec2-processor-padding-strategy/64975/1 "2023-12-07T19:22:10Z")

</div>

Hello,  
I am using data collator function from [this tutorial (Fine-Tune Wav2Vec2 for English ASR)]. ([Fine-Tune Wav2Vec2 for English ASR in Hugging Face with 🤗 Transformers](https://huggingface.co/blog/fine-tune-wav2vec2-english)) I would like to pad the input tensors to a max length in the data collator part using Wav2Vec2 processor.  
First option is, setting the padding as True and setting the max\_length as following:

```auto
        batch = self.processor.pad(
            input_features,
            padding=True,
            max_length=1000,
            return_tensors="pt",
        )

```

but it doesn’t give me desired 1000 long vectors, instead it pads them to their max value. So I change the parameters as following:

```auto
       batch = self.processor.pad(
            input_features,
            padding='max_length',
            max_length=1000,
            return_tensors="pt",
        )

```

This results in the following error:

```auto
ValueError: Unable to create tensor, you should probably activate padding with 'padding=True' to have batched tensors with the same length.

```

How should I set the padding parameter so that all the input features are padded to max\_length?
