Week 2 Lab: Train Error - Solved

Hello, when I run this cell ( trainer.train() ), I got an error:

ValueError: You have to specify either input_ids or inputs_embeds
“”"

output_dir = f’./dialogue-summary-training-{str(int(time.time()))}’

training_args = TrainingArguments(
output_dir=output_dir,
learning_rate=1e-5,
num_train_epochs=1,
weight_decay=0.01,
logging_steps=1,
max_steps=1
)

trainer = Trainer(
model=original_model,
args=training_args,
train_dataset=tokenized_datasets[‘train’],
eval_dataset=tokenized_datasets[‘validation’]
)

trainer.train()
“”"

I don’t know what the problem is. Can you help me, please?
Many thanks.
Pelin

I’ve sold the problem. There is a typo in my tokenize_function:

def tokenize_function(example):
start_prompt = ‘Summarize the following conversation.\n\n’
end_prompt = '\n\nSumnary: ’
prompt = [start_prompt+ dialogue + end_prompt for dialogue in example[“dialogue”]]
example[‘input_ids’] = tokenizer(prompt, padding = “max_length”,
truncation=True, return_tensors=“pt”).input_ids.squeeze()
example[‘labels’] = tokenizer(example[‘summary’], padding=“max_length”, truncation=True, return_tensors=“pt”).input_ids.squeeze()

return example
It is running:)