-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Distributed Automatic SParsity with Fleet #33558
Distributed Automatic SParsity with Fleet #33558
Conversation
1. Added sparse mask generating functions, including 1D and 2Ds. 2. Added sparse pattern checking functions, including 1D and 2Ds.
1. Added model pruning functions. 2. Added optimizer decorator and sparse minimization functions.
… automatic_sparsity_utils
1. Added model pruning functions. 2. Added optimizer decorator and sparse minimization functions.
1. Added ASPOptimizer into Fleet metaoptimizer. 2. Added asp attribute into Fleet DistributedStrategy. 3. Added related test cases.
… automatic_sparsity_with_fleet
Thanks for your contribution! |
@mingxu1067 Do you have plan to support dygraph and inference? |
We do not have determined plan on DyGraph supporting so far. |
@@ -134,21 +130,36 @@ def prune_model(place, | |||
|
|||
place = fluid.CUDAPlace(0) | |||
|
|||
|
|||
|
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.
这里空行加的有点多了。
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.
Ok, 分散式那邊有沒有甚麼comment? 我一起修改後再commit一次
optimizer = fluid.contrib.mixed_precision.decorator.decorate(optimizer ) | ||
# Calling sparsity.decorate() to wrap minimize() in optimizer, which | ||
# will insert necessary masking operations for ASP workflow. | ||
optimizer = sparsity.decorate(optimizer ) |
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.
现在是amp和asp一起用有问题?那这个示例里面先不要加amp吧?
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.
ASP與AMP一起使用沒有問題,有成功使用PaddleNLP/bert的AMP + ASP做過sparse finetuning
Sorry to inform you that b6f90d4's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
|
||
return False | ||
|
||
def _disable_strategy(self, dist_strategy): |
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.
set dist_strategy.asp = False ?
return | ||
|
||
def _enable_strategy(self, dist_strategy, context): | ||
return |
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.
set dist_strategy.asp = True ?
1. Added enable/disable policy controlling in asp_optimizer. 2. Changed unittests.
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.
LGTM for Fleet strategy
PR types
New featuresPR changes
APIs
Describe
Code example: