-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[Fluid] Move distributed_fused_lamb_init to phi #55993
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@GhostScreaming 老师可以帮我看一下,这个enforce应该怎么改吗? |
std::vector<DenseTensor *> master_param_out, | ||
std::vector<DenseTensor *> grad_out, | ||
DenseTensor *global_scale, | ||
DenseTensor *step) { |
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.
@zeroRains 辛苦改一下~
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.
额,这个应该是我的代码格式工具自动把我改好的风格又改回去了,等enforce的那个问题修好后我再一起push上来吧
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.
@GhostScreaming 老师,这个我修改成靠近类型之后,用pre-commit时他又自动改回靠变量那边了。。。。这咋整
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.
先这样吧,问题不大
|
||
PADDLE_ENFORCE_EQ( | ||
param.size(), | ||
param_out.size(), |
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.
这里param_out需要申请空间,否则size是0,可以参考fluid下MultiOutput的内部实现
@GhostScreaming 老师,pr可以review了 |
kernel->OutputAt(7).SetDataType(phi::DataType::FLOAT32); | ||
kernel->OutputAt(8).SetDataType(phi::DataType::INT32); | ||
kernel->OutputAt(9).SetDataType(phi::DataType::INT32); | ||
kernel->OutputAt(10).SetDataType(phi::DataType::INT32); |
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.
param_out
, grad_out
的类型应该与Input的param
一致,(可能为phi::DataType::FLOAT32
或者phi::DataType::FLOAT16
)master_param_out
的类型应该为phi::DataType::FLOAT32
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.
Done
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.
paddle/fluid/operators/optimizers/cast_with_ptr.h
可以删掉了,只有distributed_fused_lamb_init
依赖这个文件
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.
Done
|
||
CopyAndShareBufferForInitedTensor( | ||
dev_ctx, info.param_t, fp16_p_t, info.numel_offset); | ||
// PADDLE_ENFORCE_EQ( |
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.
@GhostScreaming 老师可以帮我看一下,这个enforce应该怎么改吗?
额之前我是试着改了一下,但是发生了编译错误,也问了一下老师您。您可能没看到,后面我尝试用一个指针变量接收分配结果,再进行检查也不行,所以就先注释了先改别的。老师麻烦您帮我看看这个应该怎么改呢? @GhostScreaming
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.
master_param_out
已经和sliced_tensor
share buffer了,再给它分配空间是不是有点问题?直接调master_param_out[info.idx]->data<float>()
试试?
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.
好像还是不行
@GhostScreaming
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.
好像还是不行 @GhostScreaming
可以按下面的用法试下:
float* master_param_tmp = dev_ctx.template Alloc(master_param_out[info.idx]);
float* sliced_tensor_tmp = reinterpret_cast<float*>(sliced_tensor.data());
PADDLE_ENFORCE_EQ( master_param_tmp, sliced_tensor_tmp,
errors::InvalidArgument("Invalid master weight tensor pointer."));
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.
好像还是不行 @GhostScreaming
可以按下面的用法试下: float* master_param_tmp = dev_ctx.template Alloc(master_param_out[info.idx]); float* sliced_tensor_tmp = reinterpret_cast<float*>(sliced_tensor.data()); PADDLE_ENFORCE_EQ( master_param_tmp, sliced_tensor_tmp, errors::InvalidArgument("Invalid master weight tensor pointer."));
解决了,谢谢老师!
kernel->OutputAt(7).SetDataType(phi::DataType::FLOAT32); | ||
kernel->OutputAt(8).SetDataType(phi::DataType::INT32); | ||
kernel->OutputAt(9).SetDataType(phi::DataType::INT32); | ||
kernel->OutputAt(10).SetDataType(phi::DataType::INT32); |
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.
param_out
, grad_out
的类型应该与Input的param
一致,(可能为phi::DataType::FLOAT32
或者phi::DataType::FLOAT16
)master_param_out
的类型应该为phi::DataType::FLOAT32
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.
Done
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
std::vector<DenseTensor *> master_param_out, | ||
std::vector<DenseTensor *> grad_out, | ||
DenseTensor *global_scale, | ||
DenseTensor *step) { |
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.
先这样吧,问题不大
PR types
Others
PR changes
Others
Description
将distributed_fused_lamb_init 迁移到phi下