-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[Model] Support NVLM-D and fix QK Norm in InternViT #9045
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
698921d
Support NVLM-D
DarkLight1337 33f3a50
Fix wrong module
DarkLight1337 20ebb75
Avoid warning when loading config
DarkLight1337 de39406
Fix `mlp1` loading
DarkLight1337 fe3ba5b
Fix model loading
DarkLight1337 92454b8
Use NVLM-specific modules
DarkLight1337 efb8f26
Load the correct vision model
DarkLight1337 26f4496
Adopt the original version of RMSNorm which uses custom variance
DarkLight1337 d76ef50
Remove extra transpose
DarkLight1337 dead63e
Simplify code
DarkLight1337 f0d3003
Remove unused code
DarkLight1337 72a71d5
Update input processing
DarkLight1337 15eb917
Merge branch 'main' into nvlm_d
DarkLight1337 1a8fd37
Format
DarkLight1337 bfd910a
Fix and abstract input pipeline
DarkLight1337 fc710a1
Add support for online serving
DarkLight1337 6d38309
Fix wrong embeddings
DarkLight1337 3a89f90
Fix docs
DarkLight1337 83d54f2
Update examples
DarkLight1337 3144be2
Fix incorrect head size
DarkLight1337 43d546c
Add sanity checks
DarkLight1337 2ec7fc1
Fix parallel attention not being used correctly
DarkLight1337 6a6f477
Merge branch 'main' into nvlm_d
DarkLight1337 b5ea51b
Merge branch 'main' into nvlm_d
ywang96 49e3dad
fix qk norm for paralleled VIT attention
ywang96 759e749
clean up
ywang96 5c2d303
add comment
ywang96 6d54d59
update nvlm-d multi-image
ywang96 47ed7e1
Merge branch 'main' into nvlm_d
DarkLight1337 1b57db8
Add header to docs
DarkLight1337 7728064
Consolidate code
DarkLight1337 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,8 +60,6 @@ | |
"PhiMoEForCausalLM": ("phimoe", "PhiMoEForCausalLM"), | ||
"Qwen2ForCausalLM": ("qwen2", "Qwen2ForCausalLM"), | ||
"Qwen2MoeForCausalLM": ("qwen2_moe", "Qwen2MoeForCausalLM"), | ||
"Qwen2VLForConditionalGeneration": | ||
("qwen2_vl", "Qwen2VLForConditionalGeneration"), | ||
"RWForCausalLM": ("falcon", "FalconForCausalLM"), | ||
"StableLMEpochForCausalLM": ("stablelm", "StablelmForCausalLM"), | ||
"StableLmForCausalLM": ("stablelm", "StablelmForCausalLM"), | ||
|
@@ -79,34 +77,28 @@ | |
"Qwen2ForRewardModel": ("qwen2_rm", "Qwen2ForRewardModel"), | ||
} | ||
|
||
# yapf: disable | ||
_MULTIMODAL_MODELS = { | ||
"Blip2ForConditionalGeneration": | ||
("blip2", "Blip2ForConditionalGeneration"), | ||
"ChameleonForConditionalGeneration": | ||
("chameleon", "ChameleonForConditionalGeneration"), | ||
"Blip2ForConditionalGeneration": ("blip2", "Blip2ForConditionalGeneration"), | ||
"ChameleonForConditionalGeneration": ("chameleon", "ChameleonForConditionalGeneration"), # noqa: E501 | ||
"FuyuForCausalLM": ("fuyu", "FuyuForCausalLM"), | ||
"InternVLChatModel": ("internvl", "InternVLChatModel"), | ||
"LlavaForConditionalGeneration": ("llava", | ||
"LlavaForConditionalGeneration"), | ||
"LlavaNextForConditionalGeneration": ("llava_next", | ||
"LlavaNextForConditionalGeneration"), | ||
"LlavaNextVideoForConditionalGeneration": | ||
("llava_next_video", "LlavaNextVideoForConditionalGeneration"), | ||
"LlavaOnevisionForConditionalGeneration": | ||
("llava_onevision", "LlavaOnevisionForConditionalGeneration"), | ||
"LlavaForConditionalGeneration": ("llava", "LlavaForConditionalGeneration"), | ||
"LlavaNextForConditionalGeneration": ("llava_next", "LlavaNextForConditionalGeneration"), # noqa: E501 | ||
"LlavaNextVideoForConditionalGeneration": ("llava_next_video", "LlavaNextVideoForConditionalGeneration"), # noqa: E501 | ||
"LlavaOnevisionForConditionalGeneration": ("llava_onevision", "LlavaOnevisionForConditionalGeneration"), # noqa: E501 | ||
"MiniCPMV": ("minicpmv", "MiniCPMV"), | ||
"PaliGemmaForConditionalGeneration": ("paligemma", | ||
"PaliGemmaForConditionalGeneration"), | ||
"MllamaForConditionalGeneration": ("mllama", "MllamaForConditionalGeneration"), # noqa: E501 | ||
"NVLM_D": ("nvlm_d", "InternVLChatModel"), | ||
"PaliGemmaForConditionalGeneration": ("paligemma", "PaliGemmaForConditionalGeneration"), # noqa: E501 | ||
"Phi3VForCausalLM": ("phi3v", "Phi3VForCausalLM"), | ||
"PixtralForConditionalGeneration": ("pixtral", | ||
"PixtralForConditionalGeneration"), | ||
"PixtralForConditionalGeneration": ("pixtral", "PixtralForConditionalGeneration"), # noqa: E501 | ||
"QWenLMHeadModel": ("qwen", "QWenLMHeadModel"), | ||
"Qwen2VLForConditionalGeneration": ("qwen2_vl", | ||
"Qwen2VLForConditionalGeneration"), | ||
"Qwen2VLForConditionalGeneration": ("qwen2_vl", "Qwen2VLForConditionalGeneration"), # noqa: E501 | ||
"UltravoxModel": ("ultravox", "UltravoxModel"), | ||
"MllamaForConditionalGeneration": ("mllama", | ||
"MllamaForConditionalGeneration"), | ||
} | ||
# yapf: enable | ||
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. Resorted the list in alphabetical order, and enforced one line per model to be more readable. |
||
|
||
_CONDITIONAL_GENERATION_MODELS = { | ||
"BartModel": ("bart", "BartForConditionalGeneration"), | ||
"BartForConditionalGeneration": ("bart", "BartForConditionalGeneration"), | ||
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is redundant as it's already in multimodal models, so I'm removing this.