-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Make xformers optional even if it is available #1753
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
Conversation
|
The documentation is not available anymore as the PR was closed or merged. |
|
cc @patil-suraj @pcuenca, I tend to agree here with @kn . If we make it fully optional we should however not wrap it into a "try .... else ..." statement, but just let it fail if it's not available |
pcuenca
left a comment
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.
Thanks, I think this makes sense!
|
good idea on raising an exception when xformers is used but not available! PTAL |
|
I'm in favor of this as it better follows the "no optimizations by default" API of PyTorch and should be "less surprising" for the user long-term. This change might suddenly slow down some notebooks, so also kindly pinging @apolinario and @patil-suraj here. |
patil-suraj
left a comment
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.
Thanks a lot for the PR, agree with it, makes sense to add an explicit argument here to enable exformers. Just left a nit. Also, let's add a note in the examples readme about this new argument.
| ), | ||
| ) | ||
| parser.add_argument("--local_rank", type=int, default=-1, help="For distributed training: local_rank") | ||
| parser.add_argument("--use_xformers", action="store_true", help="Whether or not to use xformers.") |
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.
(nit) could we call this arg enable_xformers_memory_efficient_attention to align with the method name?
465c1d6 to
8dc93ae
Compare
|
renamed the flag and added a note in READMEs - PTAL |
patil-suraj
left a comment
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.
Thanks a lot!
|
Thanks for the PR @kn ! |
Problem:
xformers being available doesn't always mean it should be used. For example, I install xformers because it makes inference fast but I find xformers make my dreambooth training slower.
Solution:
Require explicit flag to enable xformers when running training scripts.
Related recent change: #1640