Stop sequence eliminated for mistral models due to `skip_special_tokens=True`
Author: rolandoam
Pull request: no

### System Info

Having access to the stop sequence when using mistral models (or any model that uses the ChatML prompt template) is really useful because it can be leveraged as a way to know if the model made a full generation or it was cut. Right now, the text_generation pipeline removes the stop token in [postprocess](https://github.com/huggingface/transformers/blame/main/src/transformers/pipelines/text_generation.py#L292). Ideally, this should be a configuration that can be passed to the pipeline.

@Narsil @gante @ArthurZucker 

### Who can help?

_No response_

### 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

Use the following script to compare output directly out of `model.generate` vs out of the pipeline

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_name_or_path = "TheBloke/OpenHermes-2-Mistral-7B-GPTQ"
# To use a different branch, change revision
# For example: revision="gptq-4bit-32g-actorder_True"
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
                                             device_map="auto",
                                             trust_remote_code=False,
                                             revision="main")

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)

chat_template = "{% for message in messages %}
{{ '' + message['role'] }}\n{% if message['content'] is not none %}{{ message['content'] }}
\n{% endif %}{% endfor %}"
tokenizer.chat_template = chat_template

chats = [
    {"role": "system", "content": "You're a useful AI assistant"},
    {"role": "user", "content": "Tell me about AI"},
    {"role": "assistant", "content": None }
]

prompt = tokenizer.apply_chat_template(chats, tokenize=False)

#print("\n\n*** Generate:")

#input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
#output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
#print(tokenizer.decode(output[0]))

# Inference can also be done using transformers' pipeline

print("*** Pipeline:")
pipe = pipeline(
    "text-generation",
    model=model,
    tokenizer=tokenizer,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.7,
    top_p=0.95,
    top_k=40,
    trust_remote_code=True,
    repetition_penalty=1.1
)

print(pipe(prompt)[0]['generated_text'])
```

If you modify `text_generation.py` and change/comment `skip_special_tokens=True` in the postprocess method, then the output of the pipeline matches the expected output, including the stop sequence.

### Expected behavior

The output for mistral models should contain the stop sequence.

Comments:
Hi @rolandoam 👋 

The `pipeline` API was designed for ease of use. For full control over text generation and the tokenization process, you have the `generate` API, as commented in your code snippet :) 

Since there is a clear alternative, we are not considering adding support to the functionality you request for the time being.

thanks @gante for the input. I think you're right. I was fixated in using `pipeline` inside my custom handler but there's no reason for that. I can just call the model directly for my use case. I'll close this issue.