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
ba864e09
Commit
ba864e09
authored
Aug 02, 2023
by
lintangsutawika
Browse files
fix to add a case for if a user add `max_length` to generation_kwargs
parent
d88a566c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+3
-1
No files found.
lm_eval/models/huggingface.py
View file @
ba864e09
...
@@ -757,11 +757,13 @@ class HFLM(LM):
...
@@ -757,11 +757,13 @@ class HFLM(LM):
context_enc
=
context_enc
.
to
(
self
.
device
)
context_enc
=
context_enc
.
to
(
self
.
device
)
attn_masks
=
attn_masks
.
to
(
self
.
device
)
attn_masks
=
attn_masks
.
to
(
self
.
device
)
if
"max_length"
not
in
kwargs
:
kwargs
[
"max_length"
]
=
(
context_enc
.
shape
[
1
]
+
max_gen_toks
,)
# perform batched generation
# perform batched generation
cont
=
self
.
_model_generate
(
cont
=
self
.
_model_generate
(
context
=
context_enc
,
context
=
context_enc
,
attention_mask
=
attn_masks
,
attention_mask
=
attn_masks
,
max_length
=
context_enc
.
shape
[
1
]
+
max_gen_toks
,
stop
=
primary_until
,
stop
=
primary_until
,
**
kwargs
,
**
kwargs
,
)
)
...
...
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