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 nemo_curator import in CPU only environment when GPU packages are installed. #123

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

ayushdg
Copy link
Collaborator

@ayushdg ayushdg commented Jun 18, 2024

Fixes #109

Description

#27 Added support for installing a CPU only build of nemo_curator that works in cpu environments. However it didn't account for the case where the GPU version of curator was installed but the package was being used in CPU only environments.

One case this happens is when using the NeMo-FW container in CPU only environments. This pr extends the safe_import mechanism to fail on importError instead of ModuleNotFoundError for cases where the module was present but import failed due to missing GPUs.

One downside to this approach is that there's an implicit assumption that the importError on GPU packages stem from a missing GPU environment or missing packages, so we may wrongly classify other issues on import of these packages into the same bucket.

Usage

pip install nemo-curator[cuda12x]
import nemo_curator # in a cpu only environment passes

nemo_curator.FuzzyDuplicates() # raises relevant error message to be present in GPU environments.

Checklist

  • I am familiar with the Contributing Guide.
  • New or Existing tests cover these changes.
  • The documentation is up to date with these changes.

…ult from dependencies being present but not importable in non gpu settings

Signed-off-by: Ayush Dattagupta <[email protected]>
@ayushdg ayushdg requested a review from ryantwolf June 26, 2024 23:30
Copy link
Collaborator

@ryantwolf ryantwolf left a comment

Choose a reason for hiding this comment

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

LGTM

@ryantwolf ryantwolf merged commit e28fcec into NVIDIA:main Jun 28, 2024
3 checks passed
@ayushdg ayushdg deleted the bug-cpuonly-import-container branch June 28, 2024 23:17
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.

Import fails on cpu
2 participants