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
84f59a7f
Commit
84f59a7f
authored
Jul 01, 2024
by
Nathan Habib
Browse files
cleanup
parent
3f1c6d20
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
16 deletions
+3
-16
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+3
-16
No files found.
lm_eval/models/huggingface.py
View file @
84f59a7f
...
...
@@ -3,7 +3,6 @@ import os
from
datetime
import
timedelta
from
pathlib
import
Path
from
typing
import
Dict
,
List
,
Literal
,
Optional
,
Tuple
,
Union
import
jinja2
import
torch
import
torch.nn.functional
as
F
...
...
@@ -1321,21 +1320,9 @@ class HFLM(TemplateLM):
"""
Method to apply a chat template to a list of chat history between user and model.
"""
try
:
chat_templated
=
self
.
tokenizer
.
apply_chat_template
(
return
self
.
tokenizer
.
apply_chat_template
(
chat_history
,
tokenize
=
False
,
add_generation_prompt
=
True
)
except
jinja2
.
exceptions
.
TemplateError
:
eval_logger
.
warning
(
"Failed to apply chat template. removing the system role in chat history."
)
chat_history
=
[
msg
for
msg
in
chat_history
if
msg
[
"role"
]
!=
"system"
]
chat_templated
=
self
.
tokenizer
.
apply_chat_template
(
chat_history
,
tokenize
=
False
,
add_generation_prompt
=
True
)
return
chat_templated
def
get_model_info
(
self
)
->
dict
:
"""
...
...
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