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
c90655d5
Commit
c90655d5
authored
May 15, 2024
by
lintangsutawika
Browse files
adjust task_id
parent
6d1753dc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
lm_eval/api/task.py
lm_eval/api/task.py
+14
-6
No files found.
lm_eval/api/task.py
View file @
c90655d5
...
@@ -3,7 +3,6 @@ import ast
...
@@ -3,7 +3,6 @@ import ast
import
logging
import
logging
import
random
import
random
import
re
import
re
import
uuid
from
collections.abc
import
Callable
from
collections.abc
import
Callable
from
copy
import
deepcopy
from
copy
import
deepcopy
from
dataclasses
import
asdict
,
dataclass
from
dataclasses
import
asdict
,
dataclass
...
@@ -23,6 +22,7 @@ from typing import (
...
@@ -23,6 +22,7 @@ from typing import (
import
datasets
import
datasets
import
numpy
as
np
import
numpy
as
np
import
shortuuid
from
tqdm
import
tqdm
from
tqdm
import
tqdm
from
lm_eval
import
utils
from
lm_eval
import
utils
...
@@ -112,7 +112,7 @@ class ConfigurableGroup(abc.ABC):
...
@@ -112,7 +112,7 @@ class ConfigurableGroup(abc.ABC):
config
:
Optional
[
dict
]
=
None
,
config
:
Optional
[
dict
]
=
None
,
)
->
None
:
)
->
None
:
# Create a unique identifier ID
# Create a unique identifier ID
self
.
_task_id
=
s
tr
(
uuid
.
uuid
1
()
)
self
.
_task_id
=
s
hort
uuid
.
uuid
()
[:
8
]
self
.
_config
=
GroupConfig
(
**
config
)
self
.
_config
=
GroupConfig
(
**
config
)
@
property
@
property
...
@@ -133,7 +133,11 @@ class ConfigurableGroup(abc.ABC):
...
@@ -133,7 +133,11 @@ class ConfigurableGroup(abc.ABC):
@
property
@
property
def
task_id
(
self
)
->
Any
:
def
task_id
(
self
)
->
Any
:
return
self
.
_task_id
return
"-"
.
join
((
self
.
group_name
,
self
.
_task_id
))
@
property
def
group_name
(
self
)
->
Any
:
return
self
.
_config
.
group
def
__repr__
(
self
):
def
__repr__
(
self
):
return
(
return
(
...
@@ -318,7 +322,7 @@ class Task(abc.ABC):
...
@@ -318,7 +322,7 @@ class Task(abc.ABC):
self
.
_instances
:
Optional
[
List
[
Instance
]]
=
None
self
.
_instances
:
Optional
[
List
[
Instance
]]
=
None
# Create a unique identifier ID
# Create a unique identifier ID
self
.
_task_id
=
s
tr
(
uuid
.
uuid
1
()
)
self
.
_task_id
=
s
hort
uuid
.
uuid
()
[:
8
]
self
.
_config
:
TaskConfig
=
TaskConfig
({
**
config
})
if
config
else
TaskConfig
()
self
.
_config
:
TaskConfig
=
TaskConfig
({
**
config
})
if
config
else
TaskConfig
()
self
.
_filters
=
[
build_filter_ensemble
(
"none"
,
[[
"take_first"
,
None
]])]
self
.
_filters
=
[
build_filter_ensemble
(
"none"
,
[[
"take_first"
,
None
]])]
...
@@ -777,7 +781,7 @@ class ConfigurableTask(Task):
...
@@ -777,7 +781,7 @@ class ConfigurableTask(Task):
config
:
Optional
[
dict
]
=
None
,
config
:
Optional
[
dict
]
=
None
,
)
->
None
:
# TODO no super() call here
)
->
None
:
# TODO no super() call here
# Create a unique identifier ID
# Create a unique identifier ID
self
.
_task_id
=
s
tr
(
uuid
.
uuid
1
()
)
self
.
_task_id
=
s
hort
uuid
.
uuid
()
[:
8
]
# Get pre-configured attributes
# Get pre-configured attributes
self
.
_config
=
self
.
CONFIG
self
.
_config
=
self
.
CONFIG
...
@@ -1496,7 +1500,11 @@ class ConfigurableTask(Task):
...
@@ -1496,7 +1500,11 @@ class ConfigurableTask(Task):
@
property
@
property
def
task_id
(
self
)
->
Any
:
def
task_id
(
self
)
->
Any
:
return
self
.
_task_id
return
"-"
.
join
((
self
.
task_name
,
self
.
_task_id
))
@
property
def
task_name
(
self
)
->
Any
:
return
getattr
(
self
.
config
,
"task"
,
None
)
def
__repr__
(
self
):
def
__repr__
(
self
):
return
(
return
(
...
...
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