-
Notifications
You must be signed in to change notification settings - Fork 3k
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 inf-cl in embedding trainer #9673
base: develop
Are you sure you want to change the base?
add inf-cl in embedding trainer #9673
Conversation
Thanks for your contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9673 +/- ##
===========================================
- Coverage 53.18% 52.79% -0.40%
===========================================
Files 718 718
Lines 113340 112267 -1073
===========================================
- Hits 60282 59268 -1014
+ Misses 53058 52999 -59 ☔ View full report in Codecov by Sentry. |
__all__ = ["Simple_Inf_cl_loss", "Matryoshka_Inf_cl_loss"] | ||
|
||
|
||
class Simple_Inf_cl_loss(nn.Layer): |
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.
加一些注释
paddlenlp/trl/embedding_trainer.py
Outdated
@@ -18,6 +18,10 @@ | |||
from paddle.base import core | |||
from paddle.distributed import fleet | |||
|
|||
from ops.src.paddlenlp_kernel.triton.inf_cl.inf_cl_loss import ( |
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.
from ops.src.paddlenlp_kernel.triton.inf_cl.inf_cl_loss import ( | |
from paddlenlp_kernel.triton.inf_cl.inf_cl_loss import ( |
paddlenlp/trl/embedding_trainer.py
Outdated
@@ -18,6 +18,10 @@ | |||
from paddle.base import core | |||
from paddle.distributed import fleet | |||
|
|||
from ops.src.paddlenlp_kernel.triton.inf_cl.inf_cl_loss import ( |
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.
这个没有默认安装,需要 try except一下
PR types
Function optimization
PR changes
Others
Description
在embedding训练中增加inf_cl_loss,在超大batch_size下能有效节省显存消耗。
经测试,inf-cl算子能够与原有损失函数有效对齐:
经测试,在超大batch_size下,inf-cl算子能够有效降低embedding训练时的显存消耗:
42526MiB;42470MiB;
42470MiB;42526MiB;
42526MiB;42182MiB
28372MiB;28308MiB;
28320MiB;28384MiB;
28316MiB;28070MiB
44926MiB;45180MiB;
44674MiB;45022MiB;
45032MiB;44904MiB