In your current code, the Seq2SeqTrainingArguments class is responsible for saving checkpoints. The save_steps attribute dictates how often a checkpoint is saved. If a checkpoint is saved, you can resume training from that checkpoint at any time. Your current save_steps is set to 1000, meaning a checkpoint will be saved every 1000 steps.
If you want to save checkpoints more frequently, you can decrease the value of save_steps.
Here's the complete refactored version of your code:
import torch
from dataclasses import dataclass
from typing import Any, Dict, List, Union