    def should_save_checkpoint_on_current_rank(self) -> bool:
        """Indicates whether to save checkpoints on the current DDP rank."""
        if (
            self.is_fsdp and self.cfg.distributed_training.use_sharded_state
        ) or getattr(self.cfg.model, "base_layers", 0) > 0:
            return True
        else:
            return self.is_data_parallel_master
Indicates whether to save checkpoints on the current DDP rank.
fairseq/trainer.py