Thanks for your help, I have a another question is how can i build input to TFGPT2LMHeadModel?If i should shift one elements of inputs to build labels.is the follow code right?
type or paste code here
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)