Pytorch 2 generation/utils.py , 'torch.distributed' has no attribute 'world_size'
### System Info
transformers 4.28.0.dev0
pytorch 2 
cuda 117

File "/usr/local/lib/python3.8/dist-packages/transformers/generation/utils.py", line 1196, in generate
    if is_deepspeed_zero3_enabled() and dist.world_size() > 1:
AttributeError: module 'torch.distributed' has no attribute 'world_size'



https://github.com/huggingface/transformers-bloom-inference/blob/7bea3526d8270b4aeeefecc57d7d7d638e2bbe0e/bloom-inference-scripts/bloom-ds-zero-inference.py

### Who can help?

_No response_

### Information

- [ ] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

Pytorch 2 and generate with deepspeed stage 3. 
https://github.com/huggingface/transformers-bloom-inference/blob/7bea3526d8270b4aeeefecc57d7d7d638e2bbe0e/bloom-inference-scripts/bloom-ds-zero-inference.py

### Expected behavior

No error 
Looks like get_world_size() is supposed to be used in pytorch.distributed. [I will make a PR.](https://github.com/huggingface/transformers/pull/22381)<|||||>Should be fixed now that the PR above has been merged.