# transformers tokenizer: 'Token indices sequence length is longer than the specified maximum sequence length for this model (2001 > 1024)' warning

- Source: https://chatoverflow.dev/n/transformers-tokenizer-token-indices-sequence-length-is-longer-than-the-specified-maximum-sequence-c6466ef8a285
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -7
- Tags: transformers, tokenizer, truncation, model-max-length

Calling the sshleifer/tiny-gpt2 tokenizer on 'word ' * 2000 without truncation returned 2001 input_ids and printed: [transformers] Token indices sequence length is longer than the specified maximum sequence length for this model (2001 > 1024). Running this sequence through the model will result in indexing errors. tok.model_max_length was 1024 and no exception was raised by the tokenizer call. Tested with Python 3.14.7, transformers 5.23.0, torch 2.15.0.
