Skip to content

chore(clip): update the clip example to make it compatible with HF format#472

Merged
awni merged 8 commits intoml-explore:mainfrom
mzbac:clip
Feb 23, 2024
Merged

chore(clip): update the clip example to make it compatible with HF format#472
awni merged 8 commits intoml-explore:mainfrom
mzbac:clip

Conversation

@mzbac
Copy link
Copy Markdown
Contributor

@mzbac mzbac commented Feb 21, 2024

Update the clip model format to HF format to make it easier for later use as a vision tower in the llava model.
close #463

image

@mzbac mzbac marked this pull request as ready for review February 21, 2024 12:27
Comment thread clip/requirements.txt Outdated
Comment thread clip/convert.py Outdated
Comment thread clip/model.py Outdated
Comment thread clip/model.py Outdated
Copy link
Copy Markdown
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Awesome!! Thank you! That is a big improvement.

I left a few minor comments, let me know what you think then we can merge.

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>
@mzbac mzbac mentioned this pull request Feb 22, 2024
@mzbac
Copy link
Copy Markdown
Contributor Author

mzbac commented Feb 22, 2024

@awni, thanks for helping with reviewing the PR. I have addressed all the comments, it should be ready to merge now. Please let me know if there are any other changes needed.

Comment thread clip/model.py
Comment thread clip/test.py
@awni
Copy link
Copy Markdown
Member

awni commented Feb 22, 2024

@mzbac let me know when I should check this again

@mzbac
Copy link
Copy Markdown
Contributor Author

mzbac commented Feb 22, 2024

@awni, this is ready for merging. Once this is merged, I will work with @nkasmanoff on #461

Comment thread clip/model.py
if "position_ids" in k:
# Remove unused position_ids
continue
elif "patch_embedding.weight" in k:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

Comment thread clip/model.py Outdated
Comment thread clip/model.py Outdated
Copy link
Copy Markdown
Member

@awni awni left a comment

Choose a reason for hiding this comment

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

Looks great, thank you!!

@awni awni merged commit 47dd6bd into ml-explore:main Feb 23, 2024
@awni
Copy link
Copy Markdown
Member

awni commented Feb 23, 2024

Thanks!!

@mzbac mzbac deleted the clip branch March 3, 2024 06:41
devonthomas35 pushed a commit to devonthomas35/mlx-examples that referenced this pull request Mar 11, 2024
…rmat (ml-explore#472)

* chore(clip): update the clip model to be HF format

* Update clip/convert.py

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>

* chore: address comments

* chore: rename ClipVisionModel and ClipTextModel

* chore: add output hidden_states support

* chore: remove custom conv2d and apply weight transpose during weight sanitizing

* Update clip/model.py

* Update clip/model.py

---------

Co-authored-by: Awni Hannun <awni.hannun@gmail.com>
junpeiz pushed a commit to junpeiz/mlx-examples that referenced this pull request Jul 28, 2025
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.

Support the HF format clip example

2 participants