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
7aa13c47
Unverified
Commit
7aa13c47
authored
Jul 17, 2023
by
Hailey Schoelkopf
Committed by
GitHub
Jul 17, 2023
Browse files
Merge pull request #680 from baberabb/big-refactor_fixup
[Refactor] minor edits
parents
283cad70
43407f36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
2 deletions
+7
-2
lm_eval/api/model.py
lm_eval/api/model.py
+2
-0
lm_eval/models/huggingface.py
lm_eval/models/huggingface.py
+5
-1
scripts/write_out.py
scripts/write_out.py
+0
-1
No files found.
lm_eval/api/model.py
View file @
7aa13c47
...
...
@@ -114,6 +114,8 @@ class LM(abc.ABC):
additional_config
=
{}
if
additional_config
is
None
else
additional_config
args
=
utils
.
simple_parse_args_string
(
arg_string
)
args2
=
{
k
:
v
for
k
,
v
in
additional_config
.
items
()
if
v
is
not
None
}
if
args2
.
get
(
"device"
)
==
"mps"
or
args
.
get
(
"device"
)
==
"mps"
:
args
[
"dtype"
]
=
"float32"
return
cls
(
**
args
,
**
args2
)
@
property
...
...
lm_eval/models/huggingface.py
View file @
7aa13c47
...
...
@@ -99,7 +99,7 @@ class HFLM(LM):
if
not
(
parallelize
or
accelerator
.
num_processes
>
1
):
# use user-passed device
device_list
=
set
(
[
"cuda"
,
"cpu"
]
[
"cuda"
,
"cpu"
,
"mps"
]
+
[
f
"cuda:
{
i
}
"
for
i
in
range
(
torch
.
cuda
.
device_count
())]
)
if
device
:
...
...
@@ -107,6 +107,10 @@ class HFLM(LM):
device
=
int
(
device
)
self
.
_device
=
torch
.
device
(
device
)
eval_logger
.
info
(
f
"Using device '
{
device
}
'"
)
if
device
==
"mps"
:
eval_logger
.
info
(
"MPS is still in beta and only supports float32; setting dtype to float32."
)
else
:
eval_logger
.
info
(
"Device not specified"
)
eval_logger
.
info
(
f
"Cuda Available?
{
torch
.
cuda
.
is_available
()
}
"
)
...
...
scripts/write_out.py
View file @
7aa13c47
...
...
@@ -58,7 +58,6 @@ def main():
ctx
=
task
.
fewshot_context
(
doc
=
doc
,
num_fewshot
=
args
.
num_fewshot
,
rnd
=
rnd
,
)
f
.
write
(
ctx
+
"
\n
"
)
...
...
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