models icon indicating copy to clipboard operation
models copied to clipboard

SimNet通过向量计算句子之间的相似度吗?如果是,怎样获得句子的向量值?

Open jreros opened this issue 7 years ago • 5 comments

jreros avatar Jul 09 '19 16:07 jreros

您好,是PaddleNLP还是PaddleRec下面的SimNet?获得句子的向量值可以把要得到的句子的变量名放到fetch_list里fetch出来。

ceci3 avatar Jul 10 '19 05:07 ceci3

您好,是PaddleNLP还是PaddleRec下面的SimNet?获得句子的向量值可以把要得到的句子的变量名放到fetch_list里fetch出来。

你好,是PaddleNLP里的。谢谢回答,能详细说一下吗?

jreros avatar Jul 10 '19 08:07 jreros

比如https://github.com/PaddlePaddle/models/blob/6791e34a716761a7e8277d4414b5609e9cc8729f/PaddleNLP/models/matching/mm_dnn.py#L148这里,想拿到left_seq_encoder的值的话,在executor run的时候 fetch_list=[left_seq_encoder.name] 就可以拿到这个值了,executor run的示例可以在下面的链接看 https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/executor_cn.html#run

ceci3 avatar Jul 10 '19 09:07 ceci3

比如https://github.com/PaddlePaddle/models/blob/6791e34a716761a7e8277d4414b5609e9cc8729f/PaddleNLP/models/matching/mm_dnn.py#L148这里,想拿到left_seq_encoder的值的话,在executor run的时候 fetch_list=[left_seq_encoder.name] 就可以拿到这个值了,executor run的示例可以在下面的链接看 https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/executor_cn.html#run

明白了,谢谢!

jreros avatar Jul 10 '19 10:07 jreros

能请问如果用pre-train的模型,又该如何呢?fluid.io.load_inference_model后,fetch没办法加上像上面的例子一样加上对应layer变量。

比如https://github.com/PaddlePaddle/models/blob/6791e34a716761a7e8277d4414b5609e9cc8729f/PaddleNLP/models/matching/mm_dnn.py#L148这里,想拿到left_seq_encoder的值的话,在executor run的时候 fetch_list=[left_seq_encoder.name] 就可以拿到这个值了,executor run的示例可以在下面的链接看 https://www.paddlepaddle.org.cn/documentation/docs/zh/1.5/api_cn/executor_cn.html#run

zhouchunyi avatar Jul 16 '19 13:07 zhouchunyi