Getting error - trainer.train()
Hello, I am trying to fine tune a GPT2 model with my data. While i am use train() method getting below error.KeyError: ‘Invalid key. Only three types of key are available: (1) string, (2) integers for backend Encoding, and (3) slices for data subsetting.’below is my codecleaned_text =“”from transformers import GPT2Tokenizertokenizer = GPT2Tokenizer.from_pretrained(‘gpt2’)Add a new padding token to the tokenizertokenizer.add_special_tokens({‘pad_token’: ‘[PAD]’})Tokenize the text using GPT-2 tokenizertokenized_text = tokenizer(cleaned_text, truncation=True, padding=True)training_args = TrainingArguments(output_dir=“./gpt2-finetuned”,overwrite_output_dir=True,num_train_epochs=3,per_device_train_batch_size=2,save_steps=10_000,save_total_limit=2,)trainer = Trainer(model=model,args=training_args,train_dataset=tokenized_text,tokenizer=tokenizer,)trainer.train()
2024-04-23T13:02:27Z
hello, how were you able to fix this issue?
2024-04-24T21:06:32Z
any updates on this please ?i’m facing the same problem when fine-tuning mistral 7b
2024-04-25T00:05:25Z
Could you provide the full error log?
2024-06-03T09:53:40Z
hello, how you solve it ?