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

Fix online DPO crash when model is a DataParallel object #3225

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wilrop
Copy link

@wilrop wilrop commented Apr 3, 2025

What does this PR do?

This pull request fixes the issue described in #3063 by implementing the solution also proposed in the original issue.

Essentially, we now check whether the model is an encoder-decoder model at initialisation and store it in self. This avoids a check during training when the model may have been wrapped in a DataParallel object.

Fixes #3063

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a GitHub issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

Copy link
Member

@qgallouedec qgallouedec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@wilrop
Copy link
Author

wilrop commented Apr 5, 2025

One test seems to have failed due to a CUDA OOM. I'd be surprised if that was an error due to this simple change.

=========================== short test summary info ============================
FAILED tests/test_online_dpo_trainer.py::TestOnlineDPOTrainer::test_training_with_vllm_0_standard_prompt_only - torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 446.00 MiB. GPU 0 has a total capacity of 14.74 GiB of which 4.12 MiB is free. Process 29890 has 726.00 MiB memory in use. Process 29887 has 1.41 GiB memory in use. Process 29884 has 574.00 MiB memory in use. Process 29893 has 11.92 GiB memory in use. Process 38677 has 138.00 MiB memory in use. Of the allocated memory 1.19 GiB is allocated by PyTorch, and 63.59 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation.  See documentation for Memory Management  (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)
= 1 failed, 753 passed, 58 skipped, 157 warnings, 9 rerun in 631.37s (0:10:31) =
make: *** [Makefile:9: test] Error 1
Error: Process completed with exit code 2.

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

Successfully merging this pull request may close these issues.

Online DPO crashes when using multiple GPUs
3 participants