-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix the bug that parameters are note transposed. #387
fix the bug that parameters are note transposed. #387
Conversation
645f237
to
249aa15
Compare
249aa15
to
f4cdd71
Compare
hsigmoid/README.md
Outdated
|
||
## 训练阶段 | ||
训练比较简单,直接运行``` python train.py ```。程序第一次运行会检测用户缓存文件夹中是否包含imikolov数据集,如果未包含,则自动下载。运行过程中,每100个iteration会打印模型训练信息,主要包含训练损失和测试损失,每个pass会保存一次模型。 | ||
|
||
## 预测阶段 | ||
预测时,直接运行``` python infer.py ```,程序会首先load模型,然后按照batch方式进行预测,并打印预测结果。预测阶段最重要的就是根据概率得到编码路径,然后遍历路径获取最终的预测类别,这部分逻辑如下: | ||
预测时,在命令行运行 `infer.py --model_path XX`,通过`model_path`指定训练好的模型所在的路径。程序会首先load模型,然后按照batch方式进行预测,并打印预测结果。预测阶段最重要的就是根据概率得到编码路径,然后遍历路径获取最终的预测类别,这部分逻辑如下: |
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.
python infer.py --model_path ...
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.
nce_cost/README.md
Outdated
input=hidden_layer, | ||
param_attr=paddle.attr.Param(name="nce_w")) | ||
``` | ||
1. 在命令行运行 `infer.py --model_path XX`,通过`model_path`指定训练好的模型所在的路径。 |
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.
python infer.py --model_path ...
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.
The develop branch has been updated. If the parameter num_classes
is not set, it is automatically determined by the size of the inputlabel
https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/trainer_config_helpers/layers.py#L2344.
This may cause the problem if the size of label
is not correctly set (If the size of label
is not correctly set, PaddlePaddle will not throw an error.), maybe explicitly set the num_classes
is better.
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.
hsigmoid/network_conf.py
Outdated
input=hidden_layer, | ||
label=target_word, | ||
num_classes=dict_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.
According to the code: https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/gserver/layers/HierarchicalSigmoidLayer.cpp#L27, maybe num_classes
is necessary?
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.
b52c5c1
to
6d39971
Compare
6d39971
to
406761e
Compare
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!
fix the bug that when loading the parameter trained by
hsigmoid
andNCE
layer in inferring, the parameters are not transposed.