Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation during training for VLMs? #1341

Open
benjamin-marie opened this issue Nov 26, 2024 · 0 comments
Open

Validation during training for VLMs? #1341

benjamin-marie opened this issue Nov 26, 2024 · 0 comments

Comments

@benjamin-marie
Copy link

Is eval_dataset in the SFTTrainer supported by Unsloth for VLMs?

When I fine-tune Qwen2-VL and pass an evaluation dataset

trainer = SFTTrainer(
    model = model,
    tokenizer = tokenizer,
    data_collator = UnslothVisionDataCollator(model, tokenizer), # Must use!
    train_dataset = dataset_train,
    eval_dataset = dataset_validation,
    args = training_args
)

it triggers this error when it reaches the evaluation steps:

[/usr/local/lib/python3.10/dist-packages/transformers/trainer.py](https://localhost:8080/#) in compute_loss(self, model, inputs, return_outputs, num_items_in_batch)
   3652         else:
   3653             if isinstance(outputs, dict) and "loss" not in outputs:
-> 3654                 raise ValueError(
   3655                     "The model did not return a loss from the inputs, only the following keys: "
   3656                     f"{','.join(outputs.keys())}. For reference, the inputs it received are {','.join(inputs.keys())}."

ValueError: The model did not return a loss from the inputs, only the following keys: logits. For reference, the inputs it received are input_ids,attention_mask,pixel_values,image_grid_thw,labels.

I processed the evaluation dataset the same way as the training dataset (as in Unsloth's notebooks for VLMs).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant