beam_search 中记录 beam_indices 的问题
### System Info

some beam_indices become 0

### Who can help?

_No response_

### Information

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

### Tasks

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

### Reproduction

if return_dict_in_generate and output_scores:
     beam_indices = tuple((beam_indices[beam_idx[i]] + (beam_idx[i],) for i in range(len(beam_indices))))

### Expected behavior

if return_dict_in_generate and output_scores:
     beam_indices = tuple((beam_indices[i] + (beam_idx[i],) for i in range(len(beam_indices))))
Please follow the template of the issue. No one can help you without a description of the problem and a clear reproducer.