Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for multimodal input data (e.g., text + images) to flexeval, enabling evaluation of Vision Language Models (VLMs) and other multimodal language models. The implementation introduces two key features to TemplateChatDataset: parse_input_utterance to parse structured content from templates into lists of dictionaries (as required by OpenAI's multimodal API format), and preprocessor to preprocess items before template rendering (e.g., image resizing or base64 encoding).
Changes:
- Added
parse_input_utteranceparameter supportingliteral_evalandjson_loadsparsing methods - Added
preprocessorparameter accepting a list of preprocessor instances for item transformation - Created
Preprocessorabstract base class defining the preprocessor interface - Implemented
ConvertImageToBase64as an example preprocessor for image handling - Added tests for the
parse_input_utterancefunctionality
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| flexeval/core/chat_dataset/template_based.py | Core implementation of multimodal support: added Preprocessor ABC, parse_input_utterance and preprocessor parameters to TemplateChatDataset and its subclasses |
| flexeval/multimodal/image_preprocessor.py | Example implementation of image-to-base64 preprocessor with resizing support |
| flexeval/multimodal/init.py | Module initialization exporting ConvertImageToBase64 |
| tests/core/chat_dataset/test_template_based.py | Test coverage for parse_input_utterance feature with different parsing methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refer to #277.
Add
parse_input_utteranceandpreprocessortoTemplateChatDatasetto support multimodal input data.parse_input_utteranceparses structured contents used in multimodal LMspreprocessorpreprocesses each item, like image resizingAs an example of preprocessor, I created
flexeval/multimodal/image_preprocessor.py.I want to know whether such domain-specific preprocessors should be excluded from flexeval itself (and place alongside users' jsonnets).