PATCH: add back n-dim device-mesh + fix tp trainer saving (#39693)
* Feat: something
* Feat: initial changes
* tmp changes to unblock
* Refactor
* remove todo
* Feat: docstring
* Fix: saving of distributed model in trainer
* Fix: distributed saving with trainer
* Feat: add pure tp saving
* Only require tp dim if ndim > 1
* Fix: default to None
* Fix: better comments/errors
* Fix: properly check tp_size attribute
* Fix: properly check for None in tp_size
---------
Co-authored-by: Marc Sun <57196510+SunMarc@users.noreply.github.com>