Fix: Convert np.float64 to native float in memory logging#2242
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
astachowiczhabana
pushed a commit
that referenced
this pull request
Sep 11, 2025
astachowiczhabana
pushed a commit
that referenced
this pull request
Sep 17, 2025
gplutop7
pushed a commit
to HabanaAI/optimum-habana-fork
that referenced
this pull request
Oct 15, 2025
…e#2242) (huggingface#665) Co-authored-by: Yaser Afshar <yaser.afshar@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR updates the
to_gb_rounded()utility function to return a native Pythonfloatinstead of anp.float64. This change ensures cleaner and more readable logging output when memory stats are reported.Changes
np.round()tofloatinto_gb_rounded().Motivation
Previously, memory values were logged as
np.float64(82.78), which is verbose and less readable.{'loss': 0.8835, 'grad_norm': 0.45611411333084106, 'learning_rate': 0.0004, 'epoch': 1.82, 'memory_allocated (GB)': np.float64(44.35), 'max_memory_allocated (GB)': np.float64(82.8), 'total_memory_available (GB)': np.float64(94.62)}By converting to native
float, logs now show values like82.78, improving clarity for users and developers.{'loss': 0.8835, 'grad_norm': 0.45611411333084106, 'learning_rate': 0.0004, 'epoch': 1.82, 'memory_allocated (GB)': 44.35, 'max_memory_allocated (GB)': 82.8, 'total_memory_available (GB)': 94.62}Impact
Testing
Before submitting