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
38ba7dce
Unverified
Commit
38ba7dce
authored
Apr 16, 2025
by
Baber Abbasi
Committed by
GitHub
Apr 16, 2025
Browse files
fix resolve_hf_chat_template version (#2917)
* fix resolve_hf_chat_template version * pre-commit
parent
bb90a90c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+1
-1
lm_eval/models/vllm_causallms.py
lm_eval/models/vllm_causallms.py
+12
-7
No files found.
lm_eval/models/huggingface.py
View file @
38ba7dce
...
@@ -3,7 +3,7 @@ import logging
...
@@ -3,7 +3,7 @@ import logging
import
os
import
os
from
datetime
import
timedelta
from
datetime
import
timedelta
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Dict
,
List
,
Literal
,
Optional
,
Tuple
,
Union
,
Any
from
typing
import
Any
,
Dict
,
List
,
Literal
,
Optional
,
Tuple
,
Union
import
jinja2
import
jinja2
import
torch
import
torch
...
...
lm_eval/models/vllm_causallms.py
View file @
38ba7dce
...
@@ -28,7 +28,9 @@ try:
...
@@ -28,7 +28,9 @@ try:
from
vllm
import
LLM
,
SamplingParams
from
vllm
import
LLM
,
SamplingParams
from
vllm.lora.request
import
LoRARequest
from
vllm.lora.request
import
LoRARequest
from
vllm.transformers_utils.tokenizer
import
get_tokenizer
from
vllm.transformers_utils.tokenizer
import
get_tokenizer
from
vllm.entrypoints.chat_utils
import
resolve_hf_chat_template
if
parse_version
(
version
(
"vllm"
))
>=
parse_version
(
"0.8.3"
):
from
vllm.entrypoints.chat_utils
import
resolve_hf_chat_template
except
ModuleNotFoundError
:
except
ModuleNotFoundError
:
pass
pass
...
@@ -134,12 +136,15 @@ class VLLM(TemplateLM):
...
@@ -134,12 +136,15 @@ class VLLM(TemplateLM):
"Found 'gemma' in model name, a BOS token will be used as Gemma series models underperform without it."
"Found 'gemma' in model name, a BOS token will be used as Gemma series models underperform without it."
)
)
self
.
hf_chat_template
=
resolve_hf_chat_template
(
if
parse_version
(
version
(
"vllm"
))
>=
parse_version
(
"0.8.3"
):
tokenizer
=
self
.
tokenizer
,
self
.
hf_chat_template
=
resolve_hf_chat_template
(
chat_template
=
None
,
tokenizer
=
self
.
tokenizer
,
tools
=
None
,
chat_template
=
None
,
trust_remote_code
=
trust_remote_code
,
tools
=
None
,
)
trust_remote_code
=
trust_remote_code
,
)
else
:
self
.
hf_chat_template
=
None
self
.
custom_prefix_token_id
=
prefix_token_id
self
.
custom_prefix_token_id
=
prefix_token_id
if
prefix_token_id
is
not
None
:
if
prefix_token_id
is
not
None
:
...
...
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