Here is how you can create a function to truncate and map the start and end tokens of the answer to the context:

def preprocess_function(examples):
     questions = [q.strip() for q in examples["question"]]
     inputs = tokenizer(
         questions,
         examples["context"],
         max_length=384,
         truncation="only_second",
         return_offsets_mapping=True,
         padding="max_length",
     )