Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
AutoAWQ
Commits
3bb4a9f6
Commit
3bb4a9f6
authored
Sep 26, 2023
by
Casper Hansen
Browse files
Add compute_memory_used_pct function
parent
202c6d6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
awq/utils/utils.py
awq/utils/utils.py
+6
-1
No files found.
awq/utils/utils.py
View file @
3bb4a9f6
...
...
@@ -59,4 +59,9 @@ def clear_memory(weight=None):
if
weight
is
not
None
:
del
weight
gc
.
collect
()
torch
.
cuda
.
empty_cache
()
\ No newline at end of file
torch
.
cuda
.
empty_cache
()
def
compute_memory_used_pct
(
device
):
memory_used
=
torch
.
cuda
.
max_memory_allocated
(
device
)
/
(
1024
**
3
)
memory_pct
=
memory_used
/
(
torch
.
cuda
.
get_device_properties
(
device
).
total_memory
/
(
1024
**
3
))
*
100
return
memory_pct
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment