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
3b386db4
Unverified
Commit
3b386db4
authored
Nov 28, 2021
by
Leo Gao
Committed by
GitHub
Nov 28, 2021
Browse files
Make everything request_type
parent
24fde4a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
lm_eval/base.py
lm_eval/base.py
+11
-11
No files found.
lm_eval/base.py
View file @
3b386db4
...
...
@@ -667,30 +667,30 @@ REQUEST_RETURN_LENGTHS = {
class
Request
:
def
__init__
(
self
,
req_type
,
args
,
index
=
None
):
if
req_type
not
in
REQUEST_RETURN_LENGTHS
.
keys
():
raise
NotImplementedError
(
'The request type {} is not implemented!'
.
format
(
req_type
))
def
__init__
(
self
,
req
uest
_type
,
args
,
index
=
None
):
if
req
uest
_type
not
in
REQUEST_RETURN_LENGTHS
.
keys
():
raise
NotImplementedError
(
'The request type {} is not implemented!'
.
format
(
req
uest
_type
))
self
.
req_type
=
req_type
self
.
req
uest
_type
=
req
uest
_type
self
.
args
=
args
self
.
index
=
index
def
__iter__
(
self
):
if
REQUEST_RETURN_LENGTHS
[
self
.
req_type
]
is
None
:
if
REQUEST_RETURN_LENGTHS
[
self
.
req
uest
_type
]
is
None
:
raise
IndexError
(
'This request type does not return multiple arguments!'
)
for
i
in
range
(
REQUEST_RETURN_LENGTHS
[
self
.
req_type
]):
yield
Request
(
self
.
req_type
,
self
.
args
,
i
)
for
i
in
range
(
REQUEST_RETURN_LENGTHS
[
self
.
req
uest
_type
]):
yield
Request
(
self
.
req
uest
_type
,
self
.
args
,
i
)
def
__getitem__
(
self
,
i
):
if
REQUEST_RETURN_LENGTHS
[
self
.
req_type
]
is
None
:
if
REQUEST_RETURN_LENGTHS
[
self
.
req
uest
_type
]
is
None
:
raise
IndexError
(
'This request type does not return multiple arguments!'
)
return
Request
(
self
.
req_type
,
self
.
args
,
i
)
return
Request
(
self
.
req
uest
_type
,
self
.
args
,
i
)
def
__eq__
(
self
,
other
):
return
self
.
req_type
==
other
.
request_type
and
self
.
args
==
other
.
args
and
self
.
index
==
other
.
index
return
self
.
req
uest
_type
==
other
.
request_type
and
self
.
args
==
other
.
args
and
self
.
index
==
other
.
index
def
__repr__
(
self
):
return
f
"Req_
{
self
.
req_type
}{
self
.
args
}
[
{
self
.
index
}
]
\n
"
return
f
"Req_
{
self
.
req
uest
_type
}{
self
.
args
}
[
{
self
.
index
}
]
\n
"
class
RequestFactory
:
...
...
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