-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LMMSEvalInferenceEngine #1301
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b5c47f
Add LMMSEvalInferenceEngine
elronbandel fa577d7
Update
elronbandel 1f34649
Merge branch 'main' into add-llms-inference
elronbandel 7d9d485
Merge remote-tracking branch 'origin/main' into add-llms-inference
elronbandel 5861ccb
Update
elronbandel 2035ffc
FIx
elronbandel 60c06d2
FIx
elronbandel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
examples/evaluate_image_text_to_text_lmms_eval_inference.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from tqdm import tqdm | ||
from unitxt import settings | ||
from unitxt.api import evaluate, load_dataset | ||
from unitxt.inference import LMMSEvalInferenceEngine | ||
from unitxt.text_utils import print_dict | ||
|
||
with settings.context( | ||
disable_hf_datasets_cache=False, | ||
): | ||
inference_model = LMMSEvalInferenceEngine( | ||
model_type="llava_hf", | ||
model_args="pretrained=llava-hf/llava-interleave-qwen-0.5b-hf", | ||
) | ||
|
||
dataset = load_dataset( | ||
card="cards.doc_vqa.lmms_eval", | ||
template="templates.qa.with_context.title", | ||
loader_limit=30, | ||
streaming=True, | ||
) | ||
|
||
test_dataset = list(tqdm(dataset["test"], total=30)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That does this do? Why do you nee tqdm? |
||
|
||
predictions = inference_model.infer(test_dataset) | ||
evaluated_dataset = evaluate(predictions=predictions, data=test_dataset) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you get same results as with the inference engine HFLlavaInferenceEngine? |
||
|
||
print_dict( | ||
evaluated_dataset[0], | ||
keys_to_print=[ | ||
"source", | ||
"media", | ||
"references", | ||
"processed_prediction", | ||
"score", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should document this new flag in the documentation in a relatively prominent way. (e.g. in one of the first tutorials that loads data from HF).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add this example to example main page, and disable the run of this examples by default in regressions.