Create a preprocessing function to tokenize text and truncate sequences to be no longer than DistilBERT's maximum input length:

def preprocess_function(examples):
     return tokenizer(examples["text"], truncation=True)