# How does \_batch\_encode\_plus function works?

**URL:** <https://discuss.huggingface.co/t/how-does-batch-encode-plus-function-works/47333>\
**Category:** 🤗Transformers\
**Created:** [July 19, 2023, 12:45pm UTC](https://discuss.huggingface.co/t/how-does-batch-encode-plus-function-works/47333 "2023-07-19T12:45:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![univanxx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/univanxx/32/39595_2.png) [@univanxx](https://discuss.huggingface.co/u/univanxx)\
**Post date:** [July 19, 2023, 12:45pm UTC](https://discuss.huggingface.co/t/how-does-batch-encode-plus-function-works/47333/1 "2023-07-19T12:45:19Z")

</div>

Hello everyone! I want to change a truncation order from left to right in the PreTrainedTokenizerBase class. So, I found that the “padding + truncating” process lives inside the [\_batch\_encode\_plus](https://github.com/huggingface/transformers/blob/ee4250a35f3bd5e9a4379b4907b3d8f9d5d9523f/src/transformers/tokenization_utils_base.py#L2874) function.

And now I am stuck because this function should [raise NotImplementedError](https://github.com/huggingface/transformers/blob/ee4250a35f3bd5e9a4379b4907b3d8f9d5d9523f/src/transformers/tokenization_utils_base.py#L2901C9-L2901C34). But somehow it works and completes a tokenization process… And I can`t find how to go “deeper” inside this function and see what is going further. Can someone please tell me what is going on inside this function and how to get there? Many thanks!
