Create create_token_type_ids_from_sequences for CodeGenTokenizer
Author: cridin1
Pull request: no
Labels: name: Good First Issue

### Feature request

In CodeGenTokenizer [here](src/transformers/models/codegen/tokenization_codegen.py), there is no implementation for create_token_type_ids_from_sequences.

I was looking to the tutorial for token_type_ids as a reference: [here](https://huggingface.co/docs/transformers/glossary#token-type-ids). 


### Motivation

The model in input can require the token_type_ids [see here](https://huggingface.co/docs/transformers/model_doc/codegen#transformers.CodeGenForCausalLM), so would be useful to add this feature.

### Your contribution

I think it can be used directly the one frome codebert [here](src/transformers/models/bert/tokenization_bert.py):

````
    def create_token_type_ids_from_sequences(
        self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
    ) -> List[int]:
        """
        Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence
        pair mask has the following format:

        ```
        0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
        | first sequence    | second sequence |
        ```

        If `token_ids_1` is `None`, this method only returns the first portion of the mask (0s).

        Args:
            token_ids_0 (`List[int]`):
                List of IDs.
            token_ids_1 (`List[int]`, *optional*):
                Optional second list of IDs for sequence pairs.

        Returns:
            `List[int]`: List of [token type IDs](../glossary#token-type-ids) according to the given sequence(s).
        """
        sep = [self.sep_token_id]
        cls = [self.cls_token_id]
        if token_ids_1 is None:
            return len(cls + token_ids_0 + sep) * [0]
        return len(cls + token_ids_0 + sep) * [0] + len(token_ids_1 + sep) * [1]
````

Comments:
cc @ArthurZucker 

Hey, would you like to open a PR? 🤗 

Yes, I will do it.

Are `token_type_ids` ever used by CodeGen? BERT uses `token_type_ids` to differentiate between the two sentences used for the next sentence prediction training task. To the best of my understanding, CodeGen does not do that.

Let's explore this further by comparing how `BertTokenizer` and `CodeGenTokenizer` tokenize a pair of texts. Let's first define two short texts:

```python
>>> text_a = "Text A"
>>> text_b = "Text B"
```

When we use `BertTokenizer` to tokenize the text pair, it generates `input_ids` that include both texts. Additionally, it produces `token_type_ids` to clearly mark the distinction between the two texts.

```python
>>> from transformers import BertTokenizer
>>> bert_tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
>>> tokenized_text_bert = bert_tokenizer(text_a, text_b)
>>> tokenized_text_bert
{'input_ids': [101, 3793, 1037, 102, 3793, 1038, 102], 'token_type_ids': [0, 0, 0, 0, 1, 1, 1], 'attention_mask': [1, 1, 1, 1, 1, 1, 1]}
>>> bert_tokenizer.decode(tokenized_text_bert["input_ids"])
'[CLS] text a [SEP] text b [SEP]'
```

Unlike `BertTokenizer`, `CodeGenTokenizer` does not produce `token_type_ids` in its output.

```python
>>> from transformers import CodeGenTokenizer
>>> codegen_tokenizer = CodeGenTokenizer.from_pretrained("Salesforce/codegen-350M-mono")
>>> tokenized_text_codegen = codegen_tokenizer(text_a, text_b)
>>> tokenized_text_codegen
{'input_ids': [8206, 317, 8206, 347], 'attention_mask': [1, 1, 1, 1]}
>>> codegen_tokenizer.decode(tokenized_text_codegen["input_ids"])
'Text AText B'
```

Interestingly, if `token_type_ids` are given to the `CodeGenModel.forward` function, they are embedded using the same embeddings as the `input_token_ids` ([here](https://github.com/huggingface/transformers/blob/3f69f415adcbdaedec154ba8eac220ef3276975d/src/transformers/models/codegen/modeling_codegen.py#L512-L519)). This approach seems unusual to me. I observed similar code in the [GPT2](https://github.com/huggingface/transformers/blob/3f69f415adcbdaedec154ba8eac220ef3276975d/src/transformers/models/gpt2/modeling_gpt2.py#L836-L843) model and some other as well. On the other hand, [BERT](https://github.com/huggingface/transformers/blob/3f69f415adcbdaedec154ba8eac220ef3276975d/src/transformers/models/bert/modeling_bert.py#L233) uses dedicated embedding matrix for `token_type_ids`. Is using the same embeddings for `input_token_ids` and `token_type_ids` correct?


I can take this issue!