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
7376b0fd
Commit
7376b0fd
authored
Apr 30, 2023
by
Nikhil Pinnaparaju
Browse files
Updated handling for device in lm_eval/models/gpt2.py
parent
602abceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
lm_eval/models/gpt2.py
lm_eval/models/gpt2.py
+2
-3
No files found.
lm_eval/models/gpt2.py
View file @
7376b0fd
...
...
@@ -23,9 +23,8 @@ class HFLM(BaseLM):
assert
isinstance
(
pretrained
,
str
)
assert
isinstance
(
batch_size
,
int
)
if
device
:
if
device
not
in
[
"cuda"
,
"cpu"
]:
device
=
int
(
device
)
device_list
=
set
([
"cuda"
,
"cpu"
]
+
[
f
'cuda:
{
i
}
'
for
i
in
range
(
torch
.
cuda
.
device_count
())])
if
device
and
device
in
device_list
:
self
.
_device
=
torch
.
device
(
device
)
print
(
f
"Using device '
{
device
}
'"
)
else
:
...
...
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