# Getting error in DataCollatorCTCWithPadding class while running the notebook in my local computer

**URL:** <https://discuss.huggingface.co/t/getting-error-in-datacollatorctcwithpadding-class-while-running-the-notebook-in-my-local-computer/17130>\
**Category:** Beginners\
**Created:** [April 24, 2022, 5:06pm UTC](https://discuss.huggingface.co/t/getting-error-in-datacollatorctcwithpadding-class-while-running-the-notebook-in-my-local-computer/17130 "2022-04-24T17:06:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielbubiola](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@danielbubiola](https://discuss.huggingface.co/u/danielbubiola)\
**Post date:** [April 24, 2022, 5:06pm UTC](https://discuss.huggingface.co/t/getting-error-in-datacollatorctcwithpadding-class-while-running-the-notebook-in-my-local-computer/17130/1 "2022-04-24T17:06:18Z")

</div>

Hello. I am having a problem while fine-tuning my hugging face transformers model. I have successfully ran my notebook on google colab and fine-tuned my model. However, when I try to run the same code on my local PC it gave me the following error(attached image).  
Here is my DataCollator class.

```auto
@dataclass
class DataCollatorCTCWithPadding:
    processor: Wav2Vec2Processor
    padding: Union[bool, str] = True
    max_length: Optional[int] = None
    max_length_labels: Optional[int] = None
    pad_to_multiple_of: Optional[int] = None
    pad_to_multiple_of_labels: Optional[int] = None

    def __call__ (self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
        # split inputs and labels since they have to be of different lenghts and need
        # different padding methods
        input_features = [{"input_values": feature["input_values"]} for feature in features]
        label_features = [{"input_ids": feature["labels"]} for feature in features]

        batch = self.processor.pad(
            input_features,
            padding=self.padding,
            max_length=self.max_length,
            pad_to_multiple_of=self.pad_to_multiple_of,
            return_tensors="pt",
        )
        with self.processor.as_target_processor():
            labels_batch = self.processor.pad(
                label_features,
                padding=self.padding,
                max_length=self.max_length_labels,
                pad_to_multiple_of=self.pad_to_multiple_of_labels,
                return_tensors="pt",
            )

        # replace padding with -100 to ignore loss correctly
        labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100)

        batch["labels"] = labels

        return batch

```

Can you tell me where am I doing wrong? Thank you

 ![error_message](https://us1.discourse-cdn.com/hellohellohello/original/2X/9/991f7b44b8f4639d7c3e36b9aec19e7b71e73fd2.png)
