Skip to content
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

[Feat] Add Otter to OpenCompass MMBench Evaluation #232

Merged
merged 21 commits into from
Aug 31, 2023

Conversation

Luodian
Copy link
Contributor

@Luodian Luodian commented Aug 19, 2023

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

The main motivation behind this PR is to integrate the 'otter' model into the opencompass mmbench, making it usable and testable within the platform. Additionally, efforts were made to provide clearer documentation for potential users and contributors.

Modification

The following modifications were made:

Added the 'otter' model for opencompass mmbench.
Provided documentation for the added features.
Added a README to give users a comprehensive understanding of the new addition.
Debugged the evaluation process for 'otter' in opencompass.
Removed unnecessary folders to streamline the repository structure.

BC-breaking (Optional)

As of now, there's no indication that these changes break backward compatibility. Downstream projects should continue to function as expected.

Use cases (Optional)

Users wanting to leverage the 'otter' model within the opencompass mmbench for benchmarking or other relevant tasks.
Developers or contributors seeking a clear understanding of the 'otter' model's integration through the provided documentation.

Checklist

Before PR:

  • Pre-commit or other linting tools are used to fix the potential lint issues.
  • Bug fixes are fully covered by unit tests, the case that causes the bug should be added in the unit tests.
  • The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  • The documentation has been modified accordingly, like docstring or example tutorials.

After PR:

  • If the modification has potential influence on downstream or other related projects, this PR should be tested with those projects.
  • CLA has been signed and all committers have signed the CLA in this PR.

# model settings
otter_9b_mmbench_model = dict(
type="otter-9b",
model_path="luodian/OTTER-Image-MPT7B", # noqa
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path should be changed

# evaluators = [minigpt_4_mmbench_evaluator, otter_9b_mmbench_evaluator]
# load_froms = [minigpt_4_mmbench_load_from, otter_9b_mmbench_load_from]
models = [otter_9b_mmbench_model]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert these changes

evaluators = [otter_9b_mmbench_evaluator]
load_froms = [otter_9b_mmbench_load_from]
num_gpus = 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these configuration should also be reverted

return output_text

def generate(self, batch):
images = [image.unsqueeze(0) for image in batch["inputs"]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should write a custom prompt constructor and post processor following those in MiniGPT-4

datasets = [minigpt_4_mmbench_dataloader]
evaluators = [minigpt_4_mmbench_evaluator]
load_froms = [minigpt_4_mmbench_load_from]
models = [minigpt_4_mmbench_model, otter_9b_mmbench_model]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not make any changes to this file after you evaluate your model

self.prompt_constructor = mmengine.registry.build_from_cfg(
prompt_constructor, MM_MODELS)

def post_process(self, output_text):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should create a new Post Processs class, and please refer to the implementation of MiniGPT-4

Copy link
Collaborator

@YuanLiuuuuuu YuanLiuuuuuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase this branch to the latest main branch, and fix these comments above

@Leymore Leymore assigned YuanLiuuuuuu and unassigned tonysy Aug 25, 2023
@Luodian
Copy link
Contributor Author

Luodian commented Aug 26, 2023

Please rebase this branch to the latest main branch, and fix these comments above

hi I changed it, please check again!

# model settings
otter_9b_mmbench_model = dict(
type="otter-9b",
model_path="luodian/OTTER-Image-MPT7B", # noqa
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please change to /path/to/OTTER-Image-MPT7B/, don't write path with your name


models = [minigpt_4_mmbench_model]
datasets = [minigpt_4_mmbench_dataloader]
evaluators = [minigpt_4_mmbench_evaluator]
load_froms = [minigpt_4_mmbench_load_from]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't modify this file, this file is just an example

self.post_processor = mmengine.registry.build_from_cfg(
post_processor, MM_MODELS)

def generate(self, batch):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please follow other multimodal algorithm code, write def forward to control the mode

@Luodian
Copy link
Contributor Author

Luodian commented Aug 29, 2023

hi I made the changes accordingly!

@Luodian
Copy link
Contributor Author

Luodian commented Aug 30, 2023

sorry! I've resolved the lint problem, please run workflow again~
@fangyixiao18 @YuanLiuuuuuu

@YuanLiuuuuuu YuanLiuuuuuu merged commit a4d6840 into open-compass:main Aug 31, 2023
1 check passed
go-with-me000 pushed a commit to go-with-me000/opencompass that referenced this pull request Oct 9, 2023
* add otter model for opencompass mmbench

* add docs

* add readme docs

* debug for otter opencomass eval

* delete unused folders

* change to default data path

* remove unused files

* remove unused files

* update

* update config file

* flake8 lint formated and add prompt generator

* add prompt generator to config

* add a specific postproecss

* add post processor

* add post processor

* add post processor

* update according to suggestions

* remove unused redefinition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants