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
49ee4db2
Commit
49ee4db2
authored
Mar 30, 2021
by
Leo Gao
Browse files
Handle GPTNeoConfig not having n_ctx
parent
44d7b2fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
lm_eval/models/gpt2.py
lm_eval/models/gpt2.py
+5
-1
No files found.
lm_eval/models/gpt2.py
View file @
49ee4db2
...
@@ -20,7 +20,11 @@ class GPT2LM(LM):
...
@@ -20,7 +20,11 @@ class GPT2LM(LM):
# pretrained tokenizer for neo is broken for now so just hardcoding this to gpt2
# pretrained tokenizer for neo is broken for now so just hardcoding this to gpt2
self
.
tokenizer
=
transformers
.
GPT2TokenizerFast
.
from_pretrained
(
'gpt2'
)
self
.
tokenizer
=
transformers
.
GPT2TokenizerFast
.
from_pretrained
(
'gpt2'
)
self
.
tokenizer
.
pad_token
=
"<|endoftext|>"
self
.
tokenizer
.
pad_token
=
"<|endoftext|>"
self
.
max_length
=
self
.
gpt2
.
config
.
n_ctx
try
:
self
.
max_length
=
self
.
gpt2
.
config
.
n_ctx
except
AttributeError
:
# gptneoconfig doesn't have n_ctx apparantly
self
.
max_length
=
self
.
gpt2
.
config
.
max_position_embeddings
assert
self
.
tokenizer
.
encode
(
'hello
\n\n
hello'
)
==
[
31373
,
198
,
198
,
31373
]
assert
self
.
tokenizer
.
encode
(
'hello
\n\n
hello'
)
==
[
31373
,
198
,
198
,
31373
]
...
...
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