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

Non-deterministic map operator option in data loading #1088

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

MartinGleize
Copy link
Contributor

What does this PR do? Please describe:

Add the "deterministic" boolean parameter to the map operator in data_pipeline. It follows similar semantics as the tensorflow equivalent: https://www.tensorflow.org/api_docs/python/tf/data/Dataset#map , i.e. it trades the matching of output and input order with some execution speed.

Does your PR introduce any breaking changes? If yes, please list them:
No

Check list:

  • Was the content of this PR discussed and approved via a GitHub issue? (no need for typos or documentation improvements)
  • Did you read the contributor guideline?
  • Did you make sure that your PR does only one thing instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (no need for typos, documentation, or minor internal changes)

Sorry, something went wrong.

MartinGleize and others added 9 commits January 16, 2025 21:54

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 19, 2025
@artemru artemru marked this pull request as ready for review March 20, 2025 22:31
@artemru artemru requested a review from cbalioglu as a code owner March 20, 2025 22:31
Copy link
Contributor

@cbalioglu cbalioglu left a comment

Choose a reason for hiding this comment

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

Nice! Looks good to me. I left a comment about thread pool for future reference, but it is not a blocker.


namespace fairseq2n::detail {

class thread_pool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is okay for the time-being, but note that this will clash with TBB's thread pool similar to how it clashes with OpenMP and MKL. Ideally we should leverage TBB here instead of writing our own pool implementation.

std::atomic<bool> finished_{false};
std::atomic<size_t> tasks_in_flight_{0};
std::exception_ptr exception_ptr_{};
// TODO: Use this conditionally on FAIRSEQ2N_USE_TBB instead: tbb::task_arena pool_;
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants