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
cf040ac5
Commit
cf040ac5
authored
Jul 01, 2024
by
lintangsutawika
Browse files
removed lines
parent
facb2f89
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
10 deletions
+1
-10
lm_eval/api/instance.py
lm_eval/api/instance.py
+0
-5
lm_eval/api/model.py
lm_eval/api/model.py
+1
-3
lm_eval/models/llava.py
lm_eval/models/llava.py
+0
-2
No files found.
lm_eval/api/instance.py
View file @
cf040ac5
...
@@ -6,8 +6,6 @@ OutputType = Literal[
...
@@ -6,8 +6,6 @@ OutputType = Literal[
"loglikelihood"
,
"loglikelihood_rolling"
,
"generate_until"
,
"multiple_choice"
"loglikelihood"
,
"loglikelihood_rolling"
,
"generate_until"
,
"multiple_choice"
]
]
InputType
=
Literal
[
"text"
,
"text_image"
]
@
dataclass
@
dataclass
class
Instance
:
class
Instance
:
...
@@ -16,9 +14,6 @@ class Instance:
...
@@ -16,9 +14,6 @@ class Instance:
arguments
:
tuple
arguments
:
tuple
idx
:
int
idx
:
int
# Input type for multimodal
input_type
:
InputType
=
"text"
metadata
:
Tuple
[
Optional
[
str
],
Optional
[
int
],
Optional
[
int
]]
=
field
(
metadata
:
Tuple
[
Optional
[
str
],
Optional
[
int
],
Optional
[
int
]]
=
field
(
default_factory
=
lambda
:
(
None
,
None
,
None
)
default_factory
=
lambda
:
(
None
,
None
,
None
)
)
)
...
...
lm_eval/api/model.py
View file @
cf040ac5
...
@@ -36,7 +36,7 @@ class LM(abc.ABC):
...
@@ -36,7 +36,7 @@ class LM(abc.ABC):
LM calls whenever possible.
LM calls whenever possible.
:param requests: list[Instance]
:param requests: list[Instance]
A list of Instance objects, with property `args` which returns a tuple (context, continuation
, visual_list
).
A list of Instance objects, with property `args` which returns a tuple (context, continuation).
`context: str`
`context: str`
Context string. Implementations of LM must be able to handle an
Context string. Implementations of LM must be able to handle an
empty context string.
empty context string.
...
@@ -44,8 +44,6 @@ class LM(abc.ABC):
...
@@ -44,8 +44,6 @@ class LM(abc.ABC):
The continuation over which log likelihood will be calculated. If
The continuation over which log likelihood will be calculated. If
there is a word boundary, the space should be in the continuation.
there is a word boundary, the space should be in the continuation.
For example, context="hello" continuation=" world" is correct.
For example, context="hello" continuation=" world" is correct.
'visual_list: Optional[list[dict]]'
Visual Input to the model. Can be None
:return: list[tuple[float, bool]]
:return: list[tuple[float, bool]]
A list of pairs (logprob, isgreedy)
A list of pairs (logprob, isgreedy)
...
...
lm_eval/models/llava.py
View file @
cf040ac5
...
@@ -325,9 +325,7 @@ class Llava(LM):
...
@@ -325,9 +325,7 @@ class Llava(LM):
pbar
=
tqdm
(
total
=
num_iters
,
disable
=
(
self
.
rank
!=
0
),
desc
=
"Model Responding"
)
pbar
=
tqdm
(
total
=
num_iters
,
disable
=
(
self
.
rank
!=
0
),
desc
=
"Model Responding"
)
for
chunk
in
chunks
:
for
chunk
in
chunks
:
contexts
,
all_gen_kwargs
,
visuals
=
zip
(
*
chunk
)
contexts
,
all_gen_kwargs
,
visuals
=
zip
(
*
chunk
)
# task = task[0]
# visuals = [doc_to_visual[0](doc[0])]
visuals
=
self
.
flatten
(
visuals
)
visuals
=
self
.
flatten
(
visuals
)
# we assume all gen kwargs in the batch are the same
# we assume all gen kwargs in the batch are the same
# this is safe to assume because the `grouper` object ensures it.
# this is safe to assume because the `grouper` object ensures it.
...
...
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