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

Enhance/gpu support #203

Merged
merged 10 commits into from
Feb 22, 2024
Merged

Enhance/gpu support #203

merged 10 commits into from
Feb 22, 2024

Conversation

drcege
Copy link
Collaborator

@drcege drcege commented Jan 30, 2024

GPU Model Loading

  • Models are now loaded onto GPUs where possible to maximize efficiency.
    • Currently, this feature is exclusive to Hugging Face models.
    • Adherence to the CUDA_VISIBLE_DEVICES setting ensures only designated GPUs are utilized.
    • The num_proc parameter is intelligently adjusted for optimal performance with mixed CPU/GPU operations.

Multiprocessing Strategy

  • Will automatically determine the most effective multiprocessing start method.
    • On GPU setups, forkserver is the default choice, switching to spawn if necessary.
    • For CPU-bound execution, fork provides the best compatibility and performance.
  • Users retain control over multiprocessing behavior via the MP_START_METHOD environment variable, with permissible values including auto, fork, forkserver, and spawn.

New Operator Development

  • When developing GPU-accelerated operators:
    • Declare GPU usage with self._accelerator = 'cuda'.
    • Both compute_stats and process methods should now include an optional rank parameter (rank=None) to support multi-GPU setups.

@drcege drcege added enhancement New feature or request dj:multimodal issues/PRs about multimodal data processing labels Jan 30, 2024
@drcege drcege added this to the Basic Multimodal Support milestone Jan 30, 2024
@drcege drcege self-assigned this Jan 30, 2024
@drcege drcege linked an issue Jan 30, 2024 that may be closed by this pull request
data_juicer/__init__.py Outdated Show resolved Hide resolved
@HYLcool
Copy link
Collaborator

HYLcool commented Feb 8, 2024

New Operator Development

  • When developing GPU-accelerated operators:

    • Declare GPU usage with self._accelerator = 'cuda'.
    • Both compute_stats and process methods should now include an optional rank parameter (rank=None) to support multi-GPU setups.

How about adding these instructions to the DeveloperGuide docs as well?

@drcege
Copy link
Collaborator Author

drcege commented Feb 20, 2024

Added GPU development guide.

@drcege drcege requested a review from HYLcool February 21, 2024 08:28
Copy link
Collaborator

@HYLcool HYLcool left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@drcege drcege merged commit 092b3da into main Feb 22, 2024
5 checks passed
@HYLcool HYLcool deleted the enhance/gpu branch March 7, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dj:multimodal issues/PRs about multimodal data processing enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MM] speed up OPs using hf models (clip, ...)
2 participants