How to re-construct training dataset at epoch begin in Trainer using Callback?

I want to recreate the training dataset by a function generate_custom_train_set at the beginning of every epoch, however, is there a way I could do it with Trainer using callback?

My trainer looks like

trainer = Trainer(
        model=model,
        args=args,
        train_dataset=train_dataset.,
        eval_dataset=validation_dataset,
        tokenizer=tokenizer,
)