`OperatorNotAllowedInGraphError` on using TF XLA for `generate` with Tf-GPT2 model 
Author: SushantDaga
Pull request: no

### System Info

- `transformers` version: 4.29.2
- Platform: Linux-5.4.0-1099-aws-x86_64-with-debian-buster-sid
- Python version: 3.7.16
- Huggingface_hub version: 0.15.1
- Safetensors version: not installed
- PyTorch version (GPU?): 1.13.1+cu117 (True)
- Tensorflow version (GPU?): 2.11.0 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help?

@gante 

### Information

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

### Tasks

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

### Reproduction

https://huggingface.co/blog/tf-xla-generate

### Expected behavior

It should simply work w/o errors

Instead got the following error:

```python
---------------------------------------------------------------------------
OperatorNotAllowedInGraphError            Traceback (most recent call last)
~/platypus/instant/los_angeles.py in <module>
     33 print("(will be slow as it is the first call)")
     34 start = time.time_ns()
---> 35 xla_generate(**tokenized_input_1)
     36 end = time.time_ns()
     37 print(f"Execution time -- {(end - start) / 1e6:.1f} ms\n")

~/miniconda3/envs/nanonets/lib/python3.7/site-packages/tensorflow/python/util/traceback_utils.py in error_handler(*args, **kwargs)
    151     except Exception as e:
    152       filtered_tb = _process_traceback_frames(e.__traceback__)
--> 153       raise e.with_traceback(filtered_tb) from None
    154     finally:
    155       del filtered_tb

~/miniconda3/envs/nanonets/lib/python3.7/site-packages/transformers/generation/tf_utils.py in generate(self, inputs, generation_config, logits_processor, seed, **kwargs)
    824         if not self.config.is_encoder_decoder:
    825             if generation_config.pad_token_id is not None and tf.math.reduce_any(
--> 826                 inputs_tensor[:, -1] == generation_config.pad_token_id
    827             ):
    828                 logger.warning(

OperatorNotAllowedInGraphError: Using a symbolic `tf.Tensor` as a Python `bool` is not allowed: AutoGraph did convert this function. This might indicate you are trying to use an unsupported feature.
```

Comments:
@gante Any way I can help in debugging this? Have not used TF in long time, wanted to do a comparison of latest PyTorch with Tf-XLA

Hey @SushantDaga 👋 

The script seems to be working fine on my end (local computer and [colab](https://colab.research.google.com/drive/1377siPIpYLno_DpyE9iodQgNBymTG2h-?usp=sharing)). Could you try running it with updated TF and `transformers`, to double-check?

Interesting. It is indeed working on Colab. TF, and Transformers version also seems to be fine. Seems like TF installation is still not straight forward. 
Thank you for clearing this. TF-XLA seems to be working better than native PyTorch

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.