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

Add OpenFlamingo #2237

Merged
merged 44 commits into from
Mar 4, 2024
Merged

Add OpenFlamingo #2237

merged 44 commits into from
Mar 4, 2024

Conversation

michiyasunaga
Copy link
Member

@michiyasunaga michiyasunaga commented Jan 14, 2024

Add Open Flamingo client for VHELM evaluation.

Resolves #2069

@michiyasunaga michiyasunaga changed the title add openflamingo Add OpenFlamingo Jan 16, 2024
@teetone teetone added models VHELM Holistic Evaluation of Vision-Language Models (VLM) labels Jan 16, 2024
Copy link
Contributor

@JosselinSomervilleRoberts JosselinSomervilleRoberts left a comment

Choose a reason for hiding this comment

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

A general comment.
I am not sure you took the most straightforward approach here by using an implementation as low-level as this one. Is there no huggingface implementation (or other framework?). Could you try something similar to the pipeline approach I used in the Llava PR? In this state I feel like it will very hard/impossible to update and just become dead code once something breaks. If there are no other ways then let's keep it this way

requirements.txt Outdated
@@ -168,7 +171,7 @@ torchvision==0.13.1 ; sys_platform == "darwin"
torch==1.12.1+cu113 ; sys_platform == "linux"
torchvision==0.13.1+cu113 ; sys_platform == "linux"
tqdm==4.64.1
transformers==4.36.0
transformers==4.32.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you revert this? This is going to break Llava

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review! This was a bit tricky. OpenFlamingo seems to require 4.32.0; I tried 4.36.0, but encountered errors like ImportError: cannot import name '_expand_mask' from 'transformers.models.bloom.modeling_bloom' (similar to salesforce/LAVIS#571).

setup.cfg Outdated
@@ -52,7 +52,7 @@ install_requires=
scikit-learn~=1.1.2

# Models and Metrics Extras
transformers~=4.36.0 # For anthropic_client, vision_language.huggingface_vlm_client, huggingface_client, huggingface_tokenizer, test_openai_token_cost_estimator, model_summac (via summarization_metrics)
transformers>=4.28.0 # For anthropic_client, vision_language.huggingface_vlm_client, huggingface_client, huggingface_tokenizer, test_openai_token_cost_estimator, model_summac (via summarization_metrics)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, we need transformers>=4.36.0 here

src/helm/benchmark/run_expander.py Outdated Show resolved Hide resolved
src/helm/benchmark/run_specs.py Outdated Show resolved Hide resolved
@michiyasunaga
Copy link
Member Author

A general comment.
I am not sure you took the most straightforward approach here by using an implementation as low-level as this one. Is there no huggingface implementation (or other framework?). Could you try something similar to the pipeline approach I used in the Llava PR? In this state I feel like it will very hard/impossible to update and just become dead code once something breaks. If there are no other ways then let's keep it this way

Thanks for the comment! I looked into the possibility of pipeline, but OpenFlamingo is not available on Huggingface natively, so I'm following the current official usage provided in https://github.com/mlfoundations/open_flamingo and https://huggingface.co/openflamingo/OpenFlamingo-9B-vitl-mpt7b

@JosselinSomervilleRoberts
Copy link
Contributor

Sounds good then! Can you just add those references somewhere as a comment please? Thanks!

@JosselinSomervilleRoberts
Copy link
Contributor

Hey @michiyasunaga, could you do the following things so that we get this merged?

  • Talk to @yifanmai regarding the transformers version
  • Fix the conflicts
  • Thanks!

Copy link
Collaborator

@yifanmai yifanmai left a comment

Choose a reason for hiding this comment

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

Regarding the transformers version:

  • The pinned dependencies in requirements.txt were updated recently by Update requirements.txt #2331 - you might want to check if this works.
  • If things are still broken, you should put the output of your pip freeze in a Gist and send that to me, so that I can reproduce the breakage.

@@ -165,6 +165,12 @@ tokenizer_configs:
class_name: "helm.proxy.tokenizers.huggingface_tokenizer.HuggingFaceTokenizer"
end_of_text_token: "</s>"
prefix_token: "<s>"

- name: anas-awadalla/mpt-7b
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this different from the pre-existing mpt tokenizer (which is the same as EleutherAI/gpt-neox-20b)?

@JosselinSomervilleRoberts
Copy link
Contributor

@michiyasunaga , I have fixed the comments and merge conflicts. Could you provide some commands to run these to check that it works before we merge it? Thanks!

@michiyasunaga
Copy link
Member Author

@michiyasunaga , I have fixed the comments and merge conflicts. Could you provide some commands to run these to check that it works before we merge it? Thanks!

Thank you @JosselinSomervilleRoberts! Here is the command:

helm-run --suite vhelm_debug -n 1 --conf-path src/helm/benchmark/presentation/run_specs_vhelm.conf --max-eval-instances 10 --local --exit-on-error  --models-to-run openflamingo/OpenFlamingo-9B-vitl-mpt7b

@teetone teetone self-requested a review February 27, 2024 02:29
@teetone
Copy link
Member

teetone commented Mar 4, 2024

Fixed the prompting issues we had with OpenFlamingo.

@teetone teetone dismissed JosselinSomervilleRoberts’s stale review March 4, 2024 20:01

Joss made cleaned up this PR earlier.

@teetone teetone merged commit 481d12e into main Mar 4, 2024
6 checks passed
@teetone teetone deleted the michi_openflamingo branch March 4, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models VHELM Holistic Evaluation of Vision-Language Models (VLM)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OpenFlamingo 9B model
4 participants