The model did not return a loss from the inputs, only the following keys: logits. For reference, the inputs it received are input_values

I had the same issue. I removed the data_collator argument and it worked. I think it internally handles tokenizing + padding the formatted prompt.

trainer = SFTTrainer(
    model=model,
    train_dataset=dataset["train"],
    eval_dataset=dataset["test"],
    peft_config=peft_config,
    max_seq_length=max_seq_length,
    tokenizer=tokenizer,
    formatting_func=formatting_prompts_func,
    args=training_arguments
)
3 Likes