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
a2aa804c
Commit
a2aa804c
authored
Sep 13, 2023
by
Casper Hansen
Browse files
Catch out of memory exception
parent
0091f1e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
examples/benchmark.py
examples/benchmark.py
+4
-1
No files found.
examples/benchmark.py
View file @
a2aa804c
...
@@ -55,7 +55,10 @@ def run_round(model_path, quant_file, n_generate, input_ids, batch_size):
...
@@ -55,7 +55,10 @@ def run_round(model_path, quant_file, n_generate, input_ids, batch_size):
context_time
,
generate_time
=
generate
(
model
,
input_ids
,
n_generate
)
context_time
,
generate_time
=
generate
(
model
,
input_ids
,
n_generate
)
successful_generate
=
True
successful_generate
=
True
except
RuntimeError
as
ex
:
except
RuntimeError
as
ex
:
successful_generate
=
False
if
'cuda out of memory'
in
str
(
ex
).
lower
():
successful_generate
=
False
else
:
raise
RuntimeError
(
ex
)
device
=
next
(
model
.
parameters
()).
device
device
=
next
(
model
.
parameters
()).
device
memory_used
=
torch
.
cuda
.
max_memory_allocated
(
device
)
/
(
1024
**
3
)
memory_used
=
torch
.
cuda
.
max_memory_allocated
(
device
)
/
(
1024
**
3
)
...
...
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