TextIteratorStreamer cannot be used with TextGenerationPipeline
### System Info

- `transformers` version: 4.29.2
- Platform: Linux-5.19.0-41-generic-x86_64-with-glibc2.35
- Python version: 3.8.13
- Huggingface_hub version: 0.14.1
- Safetensors version: not installed
- PyTorch version (GPU?): 2.0.0+cu117 (True)
- Tensorflow version (GPU?): 2.12.0 (True)
- Flax version (CPU?/GPU?/TPU?): 0.5.3 (cpu)
- Jax version: 0.4.10
- JaxLib version: 0.4.10
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help?

@Narsil @gante 

### 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

This issue occurs because the `TextIteratorStreamer` class contains a `Queue` field which cannot be pickled and the text generation pipeline runs a deepcopy .
https://github.com/huggingface/transformers/blob/3658488ff77ff8d45101293e749263acf437f4d5/src/transformers/pipelines/text_generation.py#L245

Code to reproduce issue:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer, pipeline

model = AutoModelForCausalLM.from_pretrained("gpt2")
tokenizer = AutoTokenizer.from_pretrained("gpt2")
streamer = TextIteratorStreamer(tokenizer)
pipe = pipeline(
    "text-generation", model=model, tokenizer=tokenizer, streamer=streamer
)
pipe("test")
```

Trace:
```python
Traceback (most recent call last):
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/raf/.pyenv/versions/develop/lib/python3.8/site-packages/transformers/pipelines/text_generation.py", line 201, in __call__
    return super().__call__(text_inputs, **kwargs)
  File "/home/raf/.pyenv/versions/develop/lib/python3.8/site-packages/transformers/pipelines/base.py", line 1119, in __call__
    return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)
  File "/home/raf/.pyenv/versions/develop/lib/python3.8/site-packages/transformers/pipelines/base.py", line 1126, in run_single
    model_outputs = self.forward(model_inputs, **forward_params)
  File "/home/raf/.pyenv/versions/develop/lib/python3.8/site-packages/transformers/pipelines/base.py", line 1025, in forward
    model_outputs = self._forward(model_inputs, **forward_params)
  File "/home/raf/.pyenv/versions/develop/lib/python3.8/site-packages/transformers/pipelines/text_generation.py", line 245, in _forward
    generate_kwargs = copy.deepcopy(generate_kwargs)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 172, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 270, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 230, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/raf/.pyenv/versions/3.8.13/lib/python3.8/copy.py", line 161, in deepcopy
    rv = reductor(4)
TypeError: cannot pickle '_thread.lock' object

Process finished with exit code 137 (interrupted by signal 9: SIGKILL)
```

### Expected behavior

Pipeline should run normally
I encountered the same problem, I submitted a PR for it.

<|||||>I am having the same issue and hope that it will be resolved soon. Thanks!<|||||>@gante comes back wednesday.

I kind of agree a shallow copy should be enough and not a deepcopy, but since the code was deliberate there might be reasons for it. If it's ok let's wait for joao to come back.<|||||>Hey everyone! Apologies for the long delay 🤗 

I agree with @Narsil, we can make it a shallow copy (I err toward deep copies, as I've been bitten by unexpected side-effects in the past). I believe the only modifications the object sees are the ones [here](https://github.com/huggingface/transformers/blob/535542d38d7f19c6347ad684347737a38107f148/src/transformers/pipelines/text_generation.py#L246), for which a shallow copy is enough.