-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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: Data from AIStore #11241
base: main
Are you sure you want to change the base?
Fix: Data from AIStore #11241
Conversation
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
Signed-off-by: monica-sekoyan <monica-sekoyan@users.noreply.github.com>
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
…istore_data_fix
…/NeMo into msekoyan/aistore_data_fix
Signed-off-by: monica-sekoyan <monica-sekoyan@users.noreply.github.com>
nemo/core/classes/modelPT.py
Outdated
@@ -902,17 +902,15 @@ def setup(self, stage: Optional[str] = None): | |||
if stage in ('fit', 'validate'): | |||
val_deferred_setup = ( | |||
'validation_ds' in self._cfg | |||
and self._cfg.validation_ds is not None | |||
and not self._cfg.validation_ds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this change? the change not self._cfg.validation_ds
seems to be the opposite of the previous self._cfg.validation_ds is not None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, sorry, the condition should be changed for self.test_dataloader()
, as it is not None but [], corrected now
nemo/core/classes/modelPT.py
Outdated
'test_ds' in self._cfg | ||
and self._cfg.test_ds is not None | ||
and self._cfg.test_ds.get('defer_setup', False) | ||
'test_ds' in self._cfg and not self._cfg.test_ds and self._cfg.test_ds.get('defer_setup', False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue as @stevehuang52 raised above
@@ -70,8 +68,7 @@ def is_datastore_cache_shared() -> bool: | |||
|
|||
|
|||
def ais_cache_base() -> str: | |||
"""Return path to local cache for AIS. | |||
""" | |||
"""Return path to local cache for AIS.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: lots of formatting changes that I'm not sure if necessary
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
…istore_data_fix
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
@@ -92,6 +92,8 @@ def __init__( | |||
self.shuffle_shards = shuffle_shards | |||
self.shard_seed = shard_seed | |||
paths = expand_sharded_filepaths(path) | |||
cache_datastore_manifests(paths) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? Wondering since this is not in LazyNeMoTarredIterator
, and that lhotse should be able to automatically fetch and cache the data? @pzelasko what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lhotse supports URLs but doesn't perform caching. If we tried caching tarred data we would run out of local space in many cases. For non-tarred data it is probably fine as these datasets would typically be rather small.
I am not familiar with NeMo's original cache_datastore_manifests
function, does it gracefully handle datasets larger than available local disk space? @monica-sekoyan @stevehuang52
nemo/utils/data_utils.py
Outdated
@@ -46,18 +46,16 @@ def is_datastore_path(path) -> bool: | |||
"""Check if a path is from a data object store. | |||
Currently, only AIStore is supported. | |||
""" | |||
return path.startswith('ais://') | |||
return path.startswith('ais://') or path.startswith('s3://') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change to is_valid_url(path)
instead? You can use from lhotse.utils import is_valid_url
or just paste
def is_valid_url(value: str) -> bool:
try:
result = urlparse(value)
return bool(result.scheme) and bool(result.netloc)
except AttributeError:
return False
nemo/utils/data_utils.py
Outdated
Returns: | ||
Local path of the object. | ||
""" | ||
if path.startswith('ais://'): | ||
if path.startswith('ais://') or path.startswith('s3://'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
nemo/utils/data_utils.py
Outdated
@@ -155,7 +150,7 @@ def datastore_path_to_local_path(store_path: str) -> str: | |||
Returns: | |||
Path to the same object in local cache. | |||
""" | |||
if store_path.startswith('ais://'): | |||
if store_path.startswith('ais://') or store_path.startswith('s3://'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
nemo/utils/data_utils.py
Outdated
@@ -298,7 +290,7 @@ def datastore_path_to_webdataset_url(store_path: str): | |||
Returns: | |||
URL which can be directly used with WebDataset. | |||
""" | |||
if store_path.startswith('ais://'): | |||
if store_path.startswith('ais://') or store_path.startswith('s3://'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
…istore_data_fix
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
…istore_data_fix
Signed-off-by: monica-sekoyan <monica-sekoyan@users.noreply.github.com>
Signed-off-by: monica-sekoyan <msekoyan@nvidia.com>
…/NeMo into msekoyan/aistore_data_fix
beep boop 🤖: 🙏 The following files have warnings. In case you are familiar with these, please try helping us to improve the code base. Your code was analyzed with PyLint. The following annotations have been identified:
Thank you for improving NeMo's documentation! |
What does this PR do ?
Changing path patterns to also take into account paths starting with
s3://
and adding cache manifests for NeMoLazyIterator.Collection: common
Changelog
Usage
# 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:
PR Type:
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