Fix resume_from_checkpoint for deepspeed
something is borked with CircleCI when a contributor has a CircleCI account that isn't set up to some requirements - we don't know what - so I re-created the PR from the original https://github.com/huggingface/transformers/pull/21735

------------------

This PR overcomes a possible issue with the using deepspeed resume when a non-deepspeed checkpoint file structure isn't there.

The original code comes from @mosheber and I had to apply a few more adjustments for tests to work after this change. The tests had to be run manually since they require gpus.

Credits to contributor's work have been correctly imported into this new PR.
_The documentation is not available anymore as the PR was closed or merged._<|||||>ok, looks like we figured out the original so closing this one.