-
Notifications
You must be signed in to change notification settings - Fork 185
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
[FSDP2][NF4Tensor][2/n] implement torch.chunk and other ops #150
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
0a13e6a
proof of concept for FSDP2 + NF4Tensor
weifengpy 9a56eaa
Merge branch 'main' into main
cpuhrsch 8180540
fsdp extention for tensor subclass
weifengpy 95b03e1
support fp32
weifengpy 3ac9d81
Merge branch 'pytorch-labs:main' into main
weifengpy 38461b3
UNIT TEST FOR STATE DICT
weifengpy bc7a764
implement to
weifengpy 8b1d037
remove torch.override from torch function
weifengpy 7ff6855
use dtype in compile unit test
weifengpy d9bcf71
add dtype in all unit test
weifengpy 923bef2
keep original dtype
weifengpy e15d244
fix linter
weifengpy d4beb8f
use torch testing @parametrize
weifengpy f41cb3d
remove unused import
weifengpy 952fbdd
Merge branch 'pytorch-labs:main' into main
weifengpy 950d9fd
sm8 for fp16
weifengpy d4eae0b
remove sm check for fp16
weifengpy 9444f2c
skip 2.2.2 and below for tracing tensor subclass
weifengpy b2c3c02
Merge branch 'pytorch-labs:main' into main
weifengpy 9be2de3
include kwargs
weifengpy 2981393
raise unimplemented
weifengpy 3ced998
Merge branch 'main' into main
weifengpy 3f1e19a
Merge branch 'pytorch-labs:main' into main
weifengpy 761416a
fsdp2 ops
weifengpy c656f1e
better diff layout
weifengpy c56d7e2
set pg size in metadata
weifengpy d656b93
remove irrelevant changes
weifengpy 5c4fe2b
add unit test
weifengpy 613bf67
Merge branch 'main' into main
msaroufim 3933bfa
torch.chunk and cpu offloading ops
weifengpy 9e6b4ec
remove strict same metadata check
weifengpy 857b8db
skip tests that needs cuda
weifengpy 8e3de02
use /( in regex match
weifengpy 912998b
fix regex
weifengpy 8926ee1
skip tests if no cuda
weifengpy 6f834ce
skip unit test if no cuda
weifengpy a8a5aaa
Merge branch 'pytorch:main' into main
weifengpy 699079d
assert cpu device
weifengpy c8b047c
name args[0] as nf4tensor
weifengpy 925602c
utils for apply to inner tensors and constructor
weifengpy e36ab6c
use original copy_
weifengpy a007027
decorator for args check
weifengpy c352552
Merge branch 'main' into main
cpuhrsch c83fdad
INNER_TENSOR_NAMES_FOR_SHARDING and unify assert in split and new_zeros
weifengpy 574fecd
Merge branch 'pytorch:main' into main
weifengpy f27760b
indicate private constant with _
weifengpy b4f51b9
Merge branch 'main' into fsdp2ops
weifengpy 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 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.
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.
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.
I think you mentioned this briefly last week but could you remind me how you figured out these would be the functions that needed to be tested. (I'm thinking ahead with a tutorial for someone who wants to upstream some new exotic dtpye and get it working with fsdp). That's probably a good candidate for what I mean by we should add another smoke test so we know for sure FSDP will work
So I ran the tests locally and they all worked and fast! So this gives me confidence the nf4 tensor now supports many new ops but it doesnt give me confidence that fsdp won't break in some way
I was hoping we could have a smoke test of the sort
fsdp(torch.nn.Sequential(LinearNF4(64,64)))
that would ensure nothing breaks and that fsdp doesn't silently drop the dtype since that functionality wasn't tested for fsdp 1 and we had to rely on twitter to get that signalThere 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.
agree that we need a smoke test on
fsdp(model)
. Not sure how to setup a multi-gpu test in torchao though. Is there some .ci files to change? Is there some example in torchAO? I am happy to fill in the actual logic into the template. As a reference, FSDP tests in pytorch are done like thispytorch/test/distributed/_composable/fsdp/test_fully_shard_training.py
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.
Something identical should work the machines we have in CI, every commit is already running on 4 A10Gs linux.g5.12xlarge. No existing example since this is our first distributed test
Let's just do this, first thing we meet tomorrow