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
c10c08a2
Commit
c10c08a2
authored
May 20, 2023
by
Benjamin Fattori
Browse files
unwrap gpt2 model to get n_ctx
parent
e4f1dfb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
lm_eval/models/gpt2.py
lm_eval/models/gpt2.py
+4
-1
No files found.
lm_eval/models/gpt2.py
View file @
c10c08a2
...
@@ -100,7 +100,10 @@ class HFLM(LM):
...
@@ -100,7 +100,10 @@ class HFLM(LM):
@
property
@
property
def
max_length
(
self
):
def
max_length
(
self
):
try
:
try
:
return
self
.
gpt2
.
config
.
n_ctx
if
hasattr
(
self
,
'accelerator'
):
return
self
.
accelerator
.
unwrap_model
(
self
.
gpt2
).
config
.
n_ctx
else
:
return
self
.
gpt2
.
config
.
n_ctx
except
AttributeError
:
except
AttributeError
:
# gptneoconfig doesn't have n_ctx apparently
# gptneoconfig doesn't have n_ctx apparently
if
hasattr
(
self
,
'accelerator'
):
if
hasattr
(
self
,
'accelerator'
):
...
...
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