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

Improved efficiency of CombinedDataset with binary search #298

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

le1nux
Copy link
Member

@le1nux le1nux commented Jan 31, 2025

What does this PR do?

CombinedDataset takes a list of datasets. When getitem is called, CombinedDataset searches for the respective dataset and returns the requested sample. Previously we were doing linear search which has O(n). I replaced it with binary search implmemented in np making it significantly faster O(log n).

Breaking Changes

None

Checklist before submitting final PR

  • My PR is minimal and addresses one issue in isolation
  • I have merged the latest version of the target branch into this feature branch
  • I have reviewed my own code w.r.t. correct implementation, missing type hints, proper documentation, etc.
  • I have run a sample config for model training
  • I have checked that all tests run through (python tests/tests.py)
  • I have updated the internal changelog (CHANGELOG_DEV.md)

@le1nux le1nux requested review from mali-git and fromm-m January 31, 2025 10:27
Copy link
Member

@fromm-m fromm-m left a comment

Choose a reason for hiding this comment

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

LGTM

@mali-git mali-git merged commit 3ebaa91 into main Jan 31, 2025
3 of 5 checks passed
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.

3 participants