when i use TFGPT2LMHeadModel, how can i build labels and input_ids?
### System Info

when i use TFGPT2LMHeadModel,i don't know how to build input_ids and labels!

### Who can help?

@patil-suraj

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

def encode_example(ds, limit=-1):
        print(len(ds))
        input_ids_list = []
        attention_maks_list = []
        label_list = []
        for row in ds:
            input_ids_list.append(row["input_ids"])
            attention_maks_list.append(row["attention_mask"])
            label_list.append(row["labels"])
        return tf.data.Dataset.from_tensor_slices(
            (input_ids_list, attention_maks_list, label_list)).map(map_example_to_dict)

or like this

def encode_example(ds, limit=-1):
        print(len(ds))
        input_ids_list = []
        attention_maks_list = []
        label_list = []
        for row in ds:
            input_ids_list.append(row["input_ids"][:-1])
            attention_maks_list.append(row["attention_mask"][:-1])
            label_list.append([-100 if k == 1 else k for k in row["labels"][1:]])
        return tf.data.Dataset.from_tensor_slices(
            (input_ids_list, attention_maks_list, label_list)).map(map_example_to_dict)




### Expected behavior

who can tell me the input_ids and label format？
Hey @Orient12! The `TFGPT2LMHeaDModel` works with CLM objectives. To that end, I think the best way for you to understand how it works would be to try it using the following script: https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling

This fine-tunes models with the CLM objective.<|||||>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.