Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add Convolutional vision Transformer (CvT)#2176

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
fffffgggg54 wants to merge32 commits intohuggingface:main
base:main
Choose a base branch
Loading
fromfffffgggg54:cvt

Conversation

fffffgggg54
Copy link
Contributor

CvT as described inhttps://arxiv.org/abs/2103.15808

Swin-era heirarchical transformer. From-scratch reimplementation, cleaner than original that exposes most module cfgs as kwargs, uses sdpa/timm style (https://github.com/microsoft/CvT/tree/main). WIP/barebones test for now, stuck at successful weight remap but incorrect activations that seem to come, at least in part, from BatchNorm layers.

Smartappli reacted with thumbs up emojiSmartappli reacted with laugh emojiSmartappli reacted with hooray emojiSmartappli reacted with heart emojiSmartappli reacted with rocket emojiSmartappli reacted with eyes emoji
@HuggingFaceDocBuilderDev

The docs for this PR livehere. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@fffffgggg54
Copy link
ContributorAuthor

Validation for cvt-13 lines up with paper (81.678 top-1 for me), acts are off from reference impl by minute amounts (MSE of logits for 1 sample off on the order of 1e-10). Initial problems had to do with norm before attn and attn residual when there is a cls_token. I'll finish this off later today most likely.

@Smartappli
Copy link

@fffffgggg54 is this still in progress ?

@fffffgggg54
Copy link
ContributorAuthor

@fffffgggg54 is this still in progress ?

Yes. I am a bit busy and traveling right now, but I am still working on getting the validation to line up with the paper. It has been a pain to try and find which part of the model deviates from the reference impl.

@fffffgggg54
Copy link
ContributorAuthor

fffffgggg54 commentedJun 28, 2024
edited
Loading

Some updates@rwightman@Smartappli: I have added thereference implementation into a branch on my fork and compared validation performance. There are some slight numerical deviations and the top-1 is off by an insignificant amount. After digging in the reference repo's validation setup, I changed the validation configurations so that the crop settings match what the authors used. The throughput of my implementation sees a ~10% increase over the reference impl on win10/pt2.2.0/fp32. Fused attn was not available. There is a bit of cleanup still (head, torchscript?, stem), but this is the last technical hurdle I was hung up on.

Smartappli reacted with heart emoji

@fffffgggg54fffffgggg54 marked this pull request as ready for reviewJune 28, 2024 12:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@fffffgggg54@HuggingFaceDocBuilderDev@Smartappli

[8]ページ先頭

©2009-2025 Movatter.jp