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
norm
vllm
Commits
0b7db411
"git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "02586da797dbfa201721d2080e2171805202f72c"
Unverified
Commit
0b7db411
authored
Jun 26, 2023
by
Zhuohan Li
Committed by
GitHub
Jun 26, 2023
Browse files
[Bug] Fix the OOM condition for CPU cache (#260)
parent
471a7a45
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletion
+3
-1
vllm/engine/llm_engine.py
vllm/engine/llm_engine.py
+1
-1
vllm/worker/worker.py
vllm/worker/worker.py
+2
-0
No files found.
vllm/engine/llm_engine.py
View file @
0b7db411
...
@@ -128,7 +128,7 @@ class LLMEngine:
...
@@ -128,7 +128,7 @@ class LLMEngine:
logger
.
info
(
f
'# GPU blocks:
{
num_gpu_blocks
}
, '
logger
.
info
(
f
'# GPU blocks:
{
num_gpu_blocks
}
, '
f
'# CPU blocks:
{
num_cpu_blocks
}
'
)
f
'# CPU blocks:
{
num_cpu_blocks
}
'
)
if
num_gpu_blocks
<=
0
or
num_cpu_blocks
<=
0
:
if
num_gpu_blocks
<=
0
:
raise
ValueError
(
"No available memory for the cache blocks. "
raise
ValueError
(
"No available memory for the cache blocks. "
"Try increasing `gpu_memory_utilization` when "
"Try increasing `gpu_memory_utilization` when "
"initializing the engine."
)
"initializing the engine."
)
...
...
vllm/worker/worker.py
View file @
0b7db411
...
@@ -113,6 +113,8 @@ class Worker:
...
@@ -113,6 +113,8 @@ class Worker:
num_gpu_blocks
=
int
((
total_gpu_memory
*
gpu_memory_utilization
num_gpu_blocks
=
int
((
total_gpu_memory
*
gpu_memory_utilization
-
peak_memory
)
//
cache_block_size
)
-
peak_memory
)
//
cache_block_size
)
num_cpu_blocks
=
int
(
cpu_swap_space
//
cache_block_size
)
num_cpu_blocks
=
int
(
cpu_swap_space
//
cache_block_size
)
num_gpu_blocks
=
max
(
num_gpu_blocks
,
0
)
num_cpu_blocks
=
max
(
num_cpu_blocks
,
0
)
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
empty_cache
()
# Reset the seed to ensure that the random state is not affected by
# Reset the seed to ensure that the random state is not affected by
...
...
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