# How to specify sequence length when using "feature-extraction"

**URL:** <https://discuss.huggingface.co/t/how-to-specify-sequence-length-when-using-feature-extraction/5793>\
**Category:** 🤗Transformers\
**Created:** [April 26, 2021, 8:33pm UTC](https://discuss.huggingface.co/t/how-to-specify-sequence-length-when-using-feature-extraction/5793 "2021-04-26T20:33:29Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![lewtun](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lewtun/32/30995_2.png) [@lewtun](https://discuss.huggingface.co/u/lewtun)\
**Post date:** [April 28, 2021, 9:42am UTC](https://discuss.huggingface.co/t/how-to-specify-sequence-length-when-using-feature-extraction/5793/4 "2021-04-28T09:42:31Z")

</div>

ah indeed it seems that no truncation is enabled in the base `Pipeline` class: [transformers/base.py at 8d43c71a1ca3ad322cc45008eb66a5611f1e017e · huggingface/transformers · GitHub](https://github.com/huggingface/transformers/blob/8d43c71a1ca3ad322cc45008eb66a5611f1e017e/src/transformers/pipelines/base.py#L641)

one alternative would be to extract the features directly from the model as described in this thread: [Truncating sequence -- within a pipeline](https://discuss.huggingface.co/t/truncating-sequence-within-a-pipeline/336/1)

this way you can enforce `truncation=True` with your tokenizer and pass the truncated inputs to the model

---

_[View the full topic](https://discuss.huggingface.co/t/how-to-specify-sequence-length-when-using-feature-extraction/5793)._
