As seen here, https://github.com/Modalities/modalities/blob/a599005e646a0ec1db343fbe1ef3be7b53cb75f9/src/modalities/trainer.py#L144, the `cumulated_loss_and_gradient_norm` is indexed directly in the train function, adding unnecessary complexity to the code. A better solution would be to encapsulate the `cumulated_loss_and_gradient_norm` within a dedicated class that implements also the reduce operations.