Fix `torchscript` tests for `AltCLIP`
# What does this PR do?

Fix `torchscript` tests for `AltCLIP`.

This model uses `roberta` as text model, which has 
```python
        self.register_buffer(
            "token_type_ids", torch.zeros(self.position_ids.size(), dtype=torch.long), persistent=False
        )
```
and this requires the change in this PR to pass the test.

See [current failing job run page](https://github.com/huggingface/transformers/actions/runs/3889079663/jobs/6637067165)
_The documentation is not available anymore as the PR was closed or merged._