-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Adding get_device_count function to the distribution_lib #21791
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
Adding get_device_count function to the distribution_lib #21791
Conversation
Summary of ChangesHello @buildwithsuhana, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances Keras's device management capabilities by introducing a new "get_device_count" utility function within the "keras.distribution" module. This function provides a standardized and convenient way for users to programmatically determine the number of available computational devices, such as GPUs, TPUs, or CPUs, that Keras can leverage, thereby simplifying device configuration and resource allocation for distributed training. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new utility function get_device_count to the distribution API. The implementation looks good, but I've identified a couple of areas for improvement. The public API docstring for the new function is misleading regarding its behavior when no device type is specified, which could confuse users. I've suggested a clarification. Additionally, the new function lacks unit tests, which are essential for ensuring its correctness and preventing future regressions. I've recommended adding a test case.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21791 +/- ##
==========================================
+ Coverage 82.59% 82.65% +0.06%
==========================================
Files 572 577 +5
Lines 58535 59335 +800
Branches 9158 9303 +145
==========================================
+ Hits 48345 49044 +699
- Misses 7853 7890 +37
- Partials 2337 2401 +64
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@buildwithsuhana |
This PR introduces a new utility function, keras.distribution.get_device_count, to the Keras distribution API.
This function allows a user to query the total number of available devices (like GPUs, TPUs, or CPUs) that Keras can see.