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
ff83e9b2
Commit
ff83e9b2
authored
Sep 15, 2022
by
jon-tow
Browse files
Manually concat tokenizer revision with subfolder
parent
b0b76d87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lm_eval/models/gpt2.py
lm_eval/models/gpt2.py
+3
-3
No files found.
lm_eval/models/gpt2.py
View file @
ff83e9b2
...
@@ -33,9 +33,9 @@ class HFLM(BaseLM):
...
@@ -33,9 +33,9 @@ class HFLM(BaseLM):
else
torch
.
device
(
"cpu"
)
else
torch
.
device
(
"cpu"
)
)
)
# TODO: update this to be less of a hack once subfolder is fixed in HF
self
.
gpt2
=
transformers
.
AutoModelForCausalLM
.
from_pretrained
(
self
.
gpt2
=
transformers
.
AutoModelForCausalLM
.
from_pretrained
(
pretrained
,
pretrained
,
# TODO: update this to be less of a hack once subfolder is fixed in HF
revision
=
revision
+
(
"/"
+
subfolder
if
subfolder
is
not
None
else
""
),
revision
=
revision
+
(
"/"
+
subfolder
if
subfolder
is
not
None
else
""
),
).
to
(
self
.
device
)
).
to
(
self
.
device
)
self
.
gpt2
.
eval
()
self
.
gpt2
.
eval
()
...
@@ -43,8 +43,8 @@ class HFLM(BaseLM):
...
@@ -43,8 +43,8 @@ class HFLM(BaseLM):
# pretrained tokenizer for neo is broken for now so just hard-coding this to gpt2
# pretrained tokenizer for neo is broken for now so just hard-coding this to gpt2
self
.
tokenizer
=
transformers
.
AutoTokenizer
.
from_pretrained
(
self
.
tokenizer
=
transformers
.
AutoTokenizer
.
from_pretrained
(
pretrained
if
tokenizer
is
None
else
tokenizer
,
pretrained
if
tokenizer
is
None
else
tokenizer
,
revision
=
revision
,
# TODO: update this to be less of a hack once subfolder is fixed in HF
subfolder
=
subfolder
,
revision
=
revision
+
(
"/"
+
subfolder
if
subfolder
is
not
None
else
""
)
,
)
)
assert
isinstance
(
assert
isinstance
(
...
...
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