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
gaoqiong
lm-evaluation-harness
Commits
b01c4893
Unverified
Commit
b01c4893
authored
Nov 27, 2023
by
Hailey Schoelkopf
Committed by
GitHub
Nov 27, 2023
Browse files
Fix gpu_memory_utilization kwarg typing, change to conditional import
parent
d86400b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
lm_eval/models/vllm_causallms.py
lm_eval/models/vllm_causallms.py
+16
-4
No files found.
lm_eval/models/vllm_causallms.py
View file @
b01c4893
...
...
@@ -7,8 +7,11 @@ import copy
from
tqdm
import
tqdm
from
lm_eval.api.registry
import
register_model
from
lm_eval
import
utils
from
vllm
import
LLM
,
SamplingParams
try
:
from
vllm
import
LLM
,
SamplingParams
except
ModuleNotFoundError
:
pass
eval_logger
=
utils
.
eval_logger
...
...
@@ -31,14 +34,23 @@ class VLLM(LM):
max_batch_size
=
None
,
max_length
:
int
=
None
,
seed
:
int
=
1234
,
gpu_memory_utilization
:
in
t
=
0.9
,
gpu_memory_utilization
:
floa
t
=
0.9
,
device
:
str
=
"cuda"
,
):
super
().
__init__
()
try
:
import
vllm
except
ModuleNotFoundError
:
raise
Exception
(
"attempted to use 'vllm' LM type, but package `vllm` is not installed.
\
please install vllm via `pip install lm-eval[vllm]` or `pip install -e .[vllm]`"
,
)
assert
"cuda"
in
device
or
device
is
None
,
"vLLM only supports CUDA"
self
.
model
=
LLM
(
model
=
pretrained
,
gpu_memory_utilization
=
gpu_memory_utilization
,
gpu_memory_utilization
=
float
(
gpu_memory_utilization
)
,
revision
=
revision
,
dtype
=
dtype
,
tokenizer_mode
=
tokenizer_mode
,
...
...
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