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
05550ef3
Unverified
Commit
05550ef3
authored
May 10, 2023
by
Stella Biderman
Committed by
GitHub
May 10, 2023
Browse files
Merge pull request #490 from jquesnelle/auto-batch-size-fix
fix adaptive batch crash when there are no new requests
parents
f71bffb0
d424f26b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
18 deletions
+21
-18
lm_eval/base.py
lm_eval/base.py
+21
-18
No files found.
lm_eval/base.py
View file @
05550ef3
...
@@ -254,6 +254,7 @@ class BaseLM(LM):
...
@@ -254,6 +254,7 @@ class BaseLM(LM):
# automatic (variable) batch size detection for vectorization
# automatic (variable) batch size detection for vectorization
# pull longest context sample from request
# pull longest context sample from request
if
len
(
re_ord
.
get_reordered
())
>
0
:
_
,
context_enc
,
continuation_enc
=
re_ord
.
get_reordered
()[
0
]
_
,
context_enc
,
continuation_enc
=
re_ord
.
get_reordered
()[
0
]
max_context
=
len
((
context_enc
+
continuation_enc
)[
-
(
self
.
max_length
+
1
)
:][:
-
1
])
max_context
=
len
((
context_enc
+
continuation_enc
)[
-
(
self
.
max_length
+
1
)
:][:
-
1
])
if
(
self
.
batch_size
==
'auto'
):
if
(
self
.
batch_size
==
'auto'
):
...
@@ -273,6 +274,8 @@ class BaseLM(LM):
...
@@ -273,6 +274,8 @@ class BaseLM(LM):
else
:
else
:
adaptive_batch_size
=
override_bs
adaptive_batch_size
=
override_bs
else
:
adaptive_batch_size
=
0
if
override_bs
is
None
else
override_bs
for
chunk
in
utils
.
chunks
(
for
chunk
in
utils
.
chunks
(
tqdm
(
re_ord
.
get_reordered
(),
disable
=
disable_tqdm
),
self
.
batch_size
if
self
.
batch_size
!=
"auto"
else
adaptive_batch_size
tqdm
(
re_ord
.
get_reordered
(),
disable
=
disable_tqdm
),
self
.
batch_size
if
self
.
batch_size
!=
"auto"
else
adaptive_batch_size
...
...
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