-
Notifications
You must be signed in to change notification settings - Fork 89
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 implementations for vision models #123
Open
yibozhong
wants to merge
30
commits into
fla-org:main
Choose a base branch
from
yibozhong:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+6,104
−91
Conversation
This file contains 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
…gingface-transformers/vit, currently with no cross-scan or bi-scan; also add a training script for cifar10 and cifar100 using plain pytorch.
@yibozhong Hi, thank you for your great job!
Thank you! |
@yzhangcs Hi, thank you for your response! My answers to your concerns:
In general, I didn't mean to separate these two folders. If it is ok, I'll introduce my changes to the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Vision models based on sub-quadratic models like SSMs are quite popular, but their codebases are separated and often complex, making them hard to use and compare.
This PR implements vision models based on FLA to make it easier to use FLA models for vision tasks and compare them in the same codebase. The architecture is mostly based on Hugging Face's implementation of Vision Transformer (ViT), with several modifications. Several implementation details include:
training/classification.py
.Embedding
,Pooler
) and initialization code for pretrained model from Hugging Face's ViT implementation.Additionally, there's a bug in
fla/layers/abc.py
, where argumentuse_rope
is not included in the initialization code. This PR fixes it.I did some quick tests to check whether these models work (being able to run with a decreasing loss) The training code is
classification.py
. And below is an example testing script:Test Environment is:
and virtual environment is:
An additional machine with a A100 GPU is used to test gated delta-net.
The test results are as follows. All with 6 layers in total. Hybrid setting has attention layers with idxs: 1,3,5. The attention mode is set to chunk by default except for rwkv6. All of the errors below are caused by respective attention implementation (e.g. triton errors).
A100: ✅
A100: ✅
fused_recurrent:✅
fused_recurrent:✅