# Subclassing DataCollator to pad additional inputs

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsubclassing-datacollator-to-pad-additional-inputs%2F30319%3E%5C
**Category:** 🤗Transformers\
**Created:** [January 24, 2023, 4:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsubclassing-datacollator-to-pad-additional-inputs%2F30319 "2023-01-24T16:01:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![UriVendict](https://avatars.discourse-cdn.com/v4/letter/u/6bbea6/32.png) [@UriVendict](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FUriVendict)%5C
**Post date:** [January 24, 2023, 4:01pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsubclassing-datacollator-to-pad-additional-inputs%2F30319%2F1 "2023-01-24T16:01:40Z")

</div>

I’m trying to use a model for token classification, but since the text comes from a DocX file, I want to add additional input which represents the formatting for each token. I’ve collected the formatting and created a (short) formatting vector per token which I concat to the LLM’s output vectors, but DataCollatorForTokenClassification doesn’t pad these additional vectors. I then get an error during training (e.g. “ValueError: expected sequence of length 1024 at dim 1 (got 882)”). What is the best/easiest way to override the DataCollator’s behavior to avoid this?
