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
660dfb71
Commit
660dfb71
authored
Oct 11, 2023
by
Zhiwei Zhuang
Browse files
check with pre-commit
parent
2bd5dcb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
.github/workflows/unit_tests.yml
.github/workflows/unit_tests.yml
+1
-1
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+3
-6
No files found.
.github/workflows/unit_tests.yml
View file @
660dfb71
...
@@ -43,7 +43,7 @@ jobs:
...
@@ -43,7 +43,7 @@ jobs:
# # mypy turned off for now
# # mypy turned off for now
# - name: Lint with mypy
# - name: Lint with mypy
# run: mypy . --ignore-missing-imports --check-untyped-defs --explicit-package-bases --warn-unreachable
# run: mypy . --ignore-missing-imports --check-untyped-defs --explicit-package-bases --warn-unreachable
Job
2
Job 2
:
testcpu
:
testcpu
:
name
:
CPU Tests
name
:
CPU Tests
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
...
...
lm_eval/models/huggingface.py
View file @
660dfb71
...
@@ -620,7 +620,7 @@ class HFLM(LM):
...
@@ -620,7 +620,7 @@ class HFLM(LM):
loglikelihoods
.
append
(
string_nll
)
loglikelihoods
.
append
(
string_nll
)
return
loglikelihoods
return
loglikelihoods
def
_batch_scheduler
(
self
,
pos
,
n_reordered_requests
):
def
_batch_scheduler
(
self
,
pos
,
n_reordered_requests
):
sched
=
pos
//
int
(
len
(
n_reordered_requests
)
/
self
.
batch_schedule
)
sched
=
pos
//
int
(
len
(
n_reordered_requests
)
/
self
.
batch_schedule
)
if
sched
in
self
.
batch_sizes
:
if
sched
in
self
.
batch_sizes
:
...
@@ -634,9 +634,7 @@ class HFLM(LM):
...
@@ -634,9 +634,7 @@ class HFLM(LM):
print
(
print
(
f
"Passed argument batch_size = auto:
{
self
.
batch_schedule
}
. Detecting largest batch size"
f
"Passed argument batch_size = auto:
{
self
.
batch_schedule
}
. Detecting largest batch size"
)
)
self
.
batch_sizes
[
sched
]
=
self
.
_detect_batch_size
(
self
.
batch_sizes
[
sched
]
=
self
.
_detect_batch_size
(
n_reordered_requests
,
pos
)
n_reordered_requests
,
pos
)
print
(
f
"Determined largest batch size:
{
self
.
batch_sizes
[
sched
]
}
"
)
print
(
f
"Determined largest batch size:
{
self
.
batch_sizes
[
sched
]
}
"
)
return
self
.
batch_sizes
[
sched
]
return
self
.
batch_sizes
[
sched
]
...
@@ -854,8 +852,7 @@ class HFLM(LM):
...
@@ -854,8 +852,7 @@ class HFLM(LM):
if
adaptive_batch_size
is
not
None
if
adaptive_batch_size
is
not
None
else
0
,
else
0
,
fn
=
self
.
_batch_scheduler
fn
=
self
.
_batch_scheduler
if
self
.
batch_size
==
"auto"
if
self
.
batch_size
==
"auto"
and
not
adaptive_batch_size
and
not
adaptive_batch_size
else
None
,
else
None
,
):
):
contexts
,
all_gen_kwargs
=
zip
(
*
chunk
)
contexts
,
all_gen_kwargs
=
zip
(
*
chunk
)
...
...
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