-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Add support for Pixtral #33449
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
Add support for Pixtral #33449
Changes from 10 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
2424d20
initial commit
ArthurZucker 4780f37
gloups
ArthurZucker 1b897b3
updates
ArthurZucker 1e97527
work
ArthurZucker fb0e78c
weights match
ArthurZucker eb76b0c
nits
ArthurZucker 334d7a9
nits
ArthurZucker 30439a1
updates to support the tokenizer :)
ArthurZucker 6544127
updates
ArthurZucker a45122b
Pixtral processor (#33454)
amyeroberts b6db4ee
Fix token expansion
amyeroberts b8df95d
nit in conversion script
ArthurZucker a6443bd
Merge branch 'add-pixtral' of github.com:huggingface/transformers int…
ArthurZucker 185c435
Fix image token list creation
amyeroberts 92c2735
done
ArthurZucker ea2d9fb
add expected results
ArthurZucker 6ee62a7
Process list of list of images (#33465)
amyeroberts 5f33680
updates
ArthurZucker cc18d88
working image and processor
ArthurZucker f04075e
this is the expected format
ArthurZucker 732071b
some fixes
ArthurZucker 3a15b4e
push current updated
ArthurZucker b773bde
working mult images!
ArthurZucker 6c58167
add a small integration test
ArthurZucker c4c32fb
Uodate configuration docstring
amyeroberts 9c621af
Formatting
amyeroberts 172b5bc
Config docstring fix
amyeroberts d34bac0
simplify model test
ArthurZucker ed74135
Merge branch 'add-pixtral' of github.com:huggingface/transformers int…
ArthurZucker e090756
fixup modeling and etests
ArthurZucker 3725e23
Return BatchMixFeature in image processor
amyeroberts 26adfec
fix some copies
ArthurZucker 4a65050
Merge branch 'add-pixtral' of github.com:huggingface/transformers int…
ArthurZucker 4ee5cfb
update
ArthurZucker 66de967
nits
ArthurZucker 07c7600
Update model docstring
amyeroberts ff04e9f
Apply suggestions from code review
amyeroberts e7fae23
Fix up
amyeroberts 324ba36
updates
ArthurZucker c4ad4e5
revert modeling changes
ArthurZucker 9f2d98b
update
ArthurZucker 4562fa4
Merge branch 'add-pixtral' of github.com:huggingface/transformers int…
ArthurZucker 97b4d93
update
ArthurZucker ce23dc3
fix load safe
ArthurZucker bbf516c
addd liscence
ArthurZucker b783e7a
update
ArthurZucker 443917f
use pixel_values as required by the model
ArthurZucker f9291ea
skip some tests and refactor
ArthurZucker db84a7d
Add pixtral image processing tests (#33476)
amyeroberts 908233f
fixup post merge
ArthurZucker 8c0f8f6
images -> pixel values
ArthurZucker b7d7760
oups sorry Mr docbuilder
ArthurZucker be154e1
isort
ArthurZucker bd721e2
fix
ArthurZucker 2eda353
fix processor tests
ArthurZucker 36e5525
small fixes
ArthurZucker 7d4bb19
nit
ArthurZucker df84fe7
update
ArthurZucker 0da8b22
last nits
ArthurZucker 8cfff1a
oups this was really breaking!
ArthurZucker 1effab2
nits
ArthurZucker f33fe19
is composition needs to be true
ArthurZucker 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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| <!--Copyright 2024 The HuggingFace Team. All rights reserved. | ||
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
| an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations under the License. | ||
| ⚠️ Note that this file is in Markdown but contain specific syntax for our doc-builder (similar to MDX) that may not be | ||
| rendered properly in your Markdown viewer. | ||
| --> | ||
|
|
||
| # Pixtral | ||
|
|
||
| # Pixtral | ||
|
|
||
| ## Overview | ||
|
|
||
| The Pixtral model was proposed in [<INSERT PAPER NAME HERE>](<INSERT PAPER LINK HERE>) by <INSERT AUTHORS HERE>. | ||
| <INSERT SHORT SUMMARY HERE> | ||
|
|
||
| The abstract from the paper is the following: | ||
|
|
||
| *<INSERT PAPER ABSTRACT HERE>* | ||
|
|
||
| Tips: | ||
|
|
||
| <INSERT TIPS ABOUT MODEL HERE> | ||
ArthurZucker marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| This model was contributed by [INSERT YOUR HF USERNAME HERE](https://huggingface.co/<INSERT YOUR HF USERNAME HERE>). | ||
amyeroberts marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| The original code can be found [here](<INSERT LINK TO GITHUB REPO HERE>). | ||
ArthurZucker marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| ## PixtralConfig | ||
|
|
||
| [[autodoc]] PixtralConfig | ||
|
|
||
| ## PixtralModel | ||
|
|
||
| [[autodoc]] PixtralModel | ||
| - forward | ||
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
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 |
|---|---|---|
|
|
@@ -187,6 +187,7 @@ | |
| phi3, | ||
| phobert, | ||
| pix2struct, | ||
| pixtral, | ||
| plbart, | ||
| poolformer, | ||
| pop2piano, | ||
|
|
||
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
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
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 |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Copyright 2024 The HuggingFace Team. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| from typing import TYPE_CHECKING | ||
|
|
||
| from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available | ||
|
|
||
|
|
||
| _import_structure = { | ||
| "configuration_pixtral": ["PixtralConfig"], | ||
| "processing_pixtral": ["PixtralProcessor"], | ||
| } | ||
|
|
||
|
|
||
| try: | ||
| if not is_torch_available(): | ||
| raise OptionalDependencyNotAvailable() | ||
| except OptionalDependencyNotAvailable: | ||
| pass | ||
| else: | ||
| _import_structure["modeling_pixtral"] = [ | ||
| "PixtralModel", | ||
| "PixtralPreTrainedModel", | ||
| ] | ||
|
|
||
| try: | ||
| if not is_vision_available(): | ||
| raise OptionalDependencyNotAvailable() | ||
| except OptionalDependencyNotAvailable: | ||
| pass | ||
| else: | ||
| _import_structure["image_processing_pixtral"] = ["PixtralImageProcessor"] | ||
|
|
||
|
|
||
| if TYPE_CHECKING: | ||
| from .configuration_pixtral import PixtralConfig, PixtralProcessor | ||
|
|
||
| try: | ||
| if not is_torch_available(): | ||
| raise OptionalDependencyNotAvailable() | ||
| except OptionalDependencyNotAvailable: | ||
| pass | ||
| else: | ||
| from .modeling_pixtral import ( | ||
| PixtralModel, | ||
| PixtralPreTrainedModel, | ||
| ) | ||
|
|
||
| try: | ||
| if not is_vision_available(): | ||
| raise OptionalDependencyNotAvailable() | ||
| except OptionalDependencyNotAvailable: | ||
| pass | ||
| else: | ||
| from .image_processing_pixtral import PixtralImageProcessor | ||
|
|
||
| else: | ||
| import sys | ||
|
|
||
| sys.modules[__name__] = _LazyModule(__name__, globals()["__file__"], _import_structure) |
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.