-
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
【Hackathon 5th No.12】Add AdaptiveLogSoftmaxWithLoss API to Paddle #59623
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
在静态图中使用create_parameter创建tensor会报错显示未初始化
我尝试使用直接创建tensor的方式替换逻辑,但是计算结果是错误的 请问静态图中create_parameter的初始化是要做其它的处理吗 |
self.n_clusters = len(self.cutoffs) - 1 | ||
self.head_size = self.shortlist_size + self.n_clusters | ||
|
||
if paddle.in_dynamic_mode(): |
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.
这个在底层区分了动态图和静态图,不需要这么写,而且下面的这种创建可训练参数也是不合理的,之前报错未初始化的问题有没有更完整的报错,可以开一下glog看看日志(GLOG_v=6)
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.
这个问题报错的位置并不在初始化的地方,而是在初始化之后第一个运算函数中报错,例如elementwise_add
或者matmul_v2
,都是和下面的报错类似
InvalidArgumentError: The phi::DenseTensor in the matmul_v2 Op's Input Variable Y(adaptive_log_softmax_with_loss_0.w_0) is not initialized.
[Hint: Expected t->IsInitialized() == true, but received t->IsInitialized():0 != true:1.] (at ..\paddle\fluid\framework\operator.cc:2950)
[operator < matmul_v2 > error]
请问如何创建可训练参数比较合理?从功能角度来讲我能否不创建参数,直接用手动创建的Tensor替代?
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.
你上面的create_parameter 这种方式就是合理的,但是其实你可以不用这么操作,你的head_weight和head_bias 应该是线性层的参数,那么你其实可以创建一个linear 的 sublayer,这两个参数就是这个子层的参数,直接拿过来用就行了
Sorry to inform you that fedcd3b's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
PR types
New features
PR changes
APIs
Description
Add AdaptiveLogSoftmaxWithLoss API to Paddle
Link
Rfc PR: PaddlePaddle/community#770
docs PR: PaddlePaddle/docs#6346
待完成