This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
[bc breaking] unify filtering functions #322
Closed
Closed
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
Summary: bc breaking, but we don't have bc yet, so just mentioning this upfront Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
vkuzo
added a commit
that referenced
this pull request
Jul 19, 2024
Summary: bc breaking, but we don't have bc yet, so just mentioning this upfront Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: 13302bf112f901b66a8fe25fbbd0ae4fc0a6e95f Pull Request resolved: #322
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Jul 19, 2024
Summary: bc breaking, but we don't have bc yet, so just mentioning this upfront Test Plan: Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
vkuzo
added a commit
that referenced
this pull request
Jul 19, 2024
Summary: bc breaking, but we don't have bc yet, so just mentioning this upfront Test Plan: Reviewers: Subscribers: Tasks: Tags: ghstack-source-id: a6664ad758ca9fa4f8a81b4d4c065c61f18cb983 Pull Request resolved: #322
vkuzo
changed the title
bc breaking - unify filtering functions
[bc breaking] unify filtering functions
Jul 22, 2024
awgu
reviewed
Jul 22, 2024
awgu
approved these changes
Jul 22, 2024
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.
seems good to me!
Summary: Before this PR, we had two top level filtering affordances on `swap_linear_with_float8_linear`: `skip_fqn_list` and `linear_layer_filter`: ``` def swap_linear_with_float8_linear( ..., skip_fqn_list: Optional[List[str]] = None, linear_layer_filter: Optional[Callable[[nn.Linear], bool]] = None, ) ``` This PR unifies them into a single filtering method which is aware of both the FQN as well as the module instance. This should be more future proof and allow for more fine grained filtering. ``` def swap_linear_with_float8_linear( ..., layer_filter_fn: Optional[Callable[[str, nn.Module], bool]] = None, ) ``` Note that the `filter_out_small_unaligned_layers` function is removed from the public API, and users are encouraged to write their own, again to make this more future proof. I'm not opposed to adding good utility functions back at some point, but IMO we should finalize the main UX first. Note that in the future (as outlined in the Meta-only UX discussion doc), we may change this function from being just a filter to also providing the float8 per-module config. I'm saving that for a separate PR, which will also be BC breaking (but we don't have BC yet). Test Plan: ``` ./test/test_everything.sh ``` Reviewers: Subscribers: Tasks: Tags: [ghstack-poisoned]
y-sq
approved these changes
Jul 22, 2024
@vkuzo has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request has been merged in 9d5f892. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Merged
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.
Stack from ghstack (oldest at bottom):
Summary:
Before this PR, we had two top level filtering affordances on
swap_linear_with_float8_linear
:skip_fqn_list
andlinear_layer_filter
:This PR unifies them into a single filtering method which is aware of both the FQN as well as the module instance. This should be more future proof and allow for more fine grained filtering.
Note that the
filter_out_small_unaligned_layers
function is removed from the public API, and users are encouraged to write their own, again to make this more future proof. I'm not opposed to adding good utility functions back at some point, but IMO we should finalize the main UX first.Note that in the future (as outlined in the Meta-only UX discussion doc), we may change this function from being just a filter to also providing the float8 per-module config. I'm saving that for a separate PR, which will also be BC breaking (but we don't have BC yet).
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: D60072597