TROCR truncating output string
Author: ronin2304
Pull request: no
Labels: name: bug

### System Info

```shell
- `transformers` version: 4.19.1
- Platform: Windows-10-10.0.19044-SP0
- Python version: 3.8.13
- Huggingface_hub version: 0.5.1
- PyTorch version (GPU?): 1.9.0+cu111 (True)
- Tensorflow version (GPU?): 2.3.1 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: (False)
- Using distributed or parallel set-up in script?: (False)
```


### Who can help?

@NielsRogge Hi, first of all , thank you for providing such a comprehensive port. I am in general impressed with the output of the model , and I haven't yet tuned it, just testing however I have an issue with long Input strings while testing TROCR, I have already searched the documentation but could find a  parameter for inference.  Example 1:
![Trocr_test](https://user-images.githubusercontent.com/105577596/168460304-4e1cf37c-769f-495e-96bf-bb744e3802d6.JPG)
Output would be: 'AUGENMENISKUSHORIZONTAL- / LAPPEN- /R' 
I assumed there might be a max_lenght ~32 so I tried
![Trocr_test_2](https://user-images.githubusercontent.com/105577596/168460387-50f1f4b0-7fbc-4e81-9d05-71f31f47bf2c.JPG)
Output would be :'SUPERCALIFRAGISLISTICEXPIALIDOCIOUSFANTAST'
Can you help me out here? Thanks in advance



### Information

- [X] 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

using script:
from transformers import TrOCRProcessor, VisionEncoderDecoderModel
#device = "cuda" if torch.cuda.is_available() else "cpu"
print_processor = TrOCRProcessor.from_pretrained('microsoft/trocr-large-printed')
print_model = VisionEncoderDecoderModel.from_pretrained('microsoft/trocr-large-printed')#.to(device)

def ocr_print_image(src_img):
  pixel_values = print_processor(images=src_img, return_tensors="pt").pixel_values
  generated_ids = print_model.generate(pixel_values)
  return print_processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
handwriting1 = Image.open(r'test_image.jpg')
ocr_print_image(handwriting1)

### Expected behavior

```shell
I would like to have an output that is not 'capped' or truncated as it seems. I realize this is edge cases however especially example one is real world and can occur often.
Thanks again.
```


Comments:
The [generate](https://huggingface.co/docs/transformers/main/en/main_classes/text_generation#transformers.generation_utils.GenerationMixin.generate) method provides an argument called `max_length` which specifies the max number of tokens to generate.

Note that generation stops when the end-of-sequence token is generated.

> The [generate](https://huggingface.co/docs/transformers/main/en/main_classes/text_generation#transformers.generation_utils.GenerationMixin.generate) method provides an argument called `max_length` which specifies the max number of tokens to generate.
> 
> Note that generation stops when the end-of-sequence token is generated.
@NielsRogge Thank you very much ! 
Cheers



This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.