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

feat: support memmap dataset with object store via Multi-Storage Client #12870

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

Conversation

jayya2
Copy link

@jayya2 jayya2 commented Apr 3, 2025

Important

The Update branch button must only be pressed in very rare occassions.
An outdated branch is never blocking the merge of a PR.
Please reach out to the automation team before pressing that button.

What does this PR do ?

Add support for using multi-storage-client to load data from object store and construct memmap-based datasets.

In multi-storage client we provide adaptors such as msc.numpy.* and msc.pickle.* which can handle both object store URLs (starting with msc://...) and POSIX file path (/path/to/your/file), so in theory, we can directly replace
existing usages, for examplenumpy.memmap(...) with msc.numpy.memmap(...).

However multis-storage client is not a required dependency at the moment, so I pre-check the module availability to play it safe in this first introduction PR to multi-storage client library.

Collection: [NLP]

Changelog

  • Add specific line by line info of high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

The GitHub Actions CI will run automatically when the "Run CICD" label is added to the PR.
To re-run CI remove and add the label again.
To run CI on an untrusted fork, a NeMo user with write access must first click "Approve and run".

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

PR Type:

  • New Feature
  • Bugfix
  • Documentation

If you haven't finished some of the above items you can still open "Draft" PR.

Who can review?

Anyone in the community is free to review the PR once the checks have passed.
Contributor guidelines contains specific people who can review PRs to various areas.

Additional Information

  • Related to # (issue)

@github-actions github-actions bot added the NLP label Apr 3, 2025
@jayya2 jayya2 changed the title feat: add object store support with Multi-Storage Client for memmap dataset feat: support memmap dataset with object store via Multi-Storage Client Apr 3, 2025
@jayya2 jayya2 force-pushed the sft-memmap-dataset branch from a3a4f18 to 7abef3f Compare April 3, 2025 18:05
@jayya2 jayya2 marked this pull request as ready for review April 3, 2025 18:30
Copy link
Collaborator

@cuichenx cuichenx left a comment

Choose a reason for hiding this comment

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

Looks good, just one question about MSC: if multistorageclient is a package in the container (so that MULTISTORAGECLIENT_AVAILABLE =True, but the environment is a normal file system, is there any impact to run multistorageclient functions

@jayya2
Copy link
Author

jayya2 commented Apr 9, 2025

Looks good, just one question about MSC: if multistorageclient is a package in the container (so that MULTISTORAGECLIENT_AVAILABLE =True, but the environment is a normal file system, is there any impact to run multistorageclient functions

@cuichenx valid point, two things here:

  • we have adaptor functions in MSC to work with both msc:// and normal file path starting with /..., example here, so it shouldn't be a problem here (MSC adaptors should just pass through normal file path to original function, so overhead is expected to be minimal)
  • Although, it's also reasonable to let users have the ability to explicitly enable MSC due to various reasons (less familiarity/confidence in a new dependency, etc) so that MSC dep introduced in some other places won't affect SFT training implicitly. It can be either via YAML config or via environment variables. Is this aligned with what you are thinking?

@cuichenx
Copy link
Collaborator

cuichenx commented Apr 9, 2025

Looks good, just one question about MSC: if multistorageclient is a package in the container (so that MULTISTORAGECLIENT_AVAILABLE =True, but the environment is a normal file system, is there any impact to run multistorageclient functions

@cuichenx valid point, two things here:

  • we have adaptor functions in MSC to work with both msc:// and normal file path starting with /..., example here, so it shouldn't be a problem here (MSC adaptors should just pass through normal file path to original function, so overhead is expected to be minimal)
  • Although, it's also reasonable to let users have the ability to explicitly enable MSC due to various reasons (less familiarity/confidence in a new dependency, etc) so that MSC dep introduced in some other places won't affect SFT training implicitly. It can be either via YAML config or via environment variables. Is this aligned with what you are thinking?

Ah, having the first bullet point is perfect. (I realized you also put this in the description but I missed that earlier).
If going through MSC adaptors has minimal risk or overhead, then I think this is fine. I don't think there is a need to add a config argument to allow user to enable/disable MSC. If they really wanted to they can easily modify the code to achieve that.

cuichenx and others added 4 commits April 9, 2025 16:32
Signed-off-by: Chen Cui <[email protected]>
Signed-off-by: Chen Cui <[email protected]>
Signed-off-by: Chen Cui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants