PaddlePaddle / PGL

Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle
Apache License 2.0
1.57k stars 309 forks source link

erniesage的例子 #166

Closed HaoRan98 closed 8 months ago

HaoRan98 commented 3 years ago

用python ./preprocessing/dump_graph.py --conf='./config/erniesage_link_predict.yaml'运行后,报错:

Traceback (most recent call last): File "./preprocessing/dump_graph.py", line 221, in dump_node_feat(config) File "./preprocessing/dump_graph.py", line 185, in dump_node_feat tokenizer = ErnieTinyTokenizer.from_pretrained(config.ernie_name) File "/home/alphis/ws/pei_zhi_huan_jing/ERNIE/ernie/tokenizing_ernie.py", line 223, in from_pretrained t = cls(vocab_dict, sp_model_path, **kwargs) File "/home/alphis/ws/pei_zhi_huan_jing/ERNIE/ernie/tokenizing_ernie.py", line 232, in init self.sp_model.Load(sp_model_path) File "/home/alphis/anaconda3/envs/nlp/lib/python3.7/site-packages/sentencepiece/init.py", line 367, in Load return self.LoadFromFile(model_file) File "/home/alphis/anaconda3/envs/nlp/lib/python3.7/site-packages/sentencepiece/init.py", line 171, in LoadFromFile return _sentencepiece.SentencePieceProcessor_LoadFromFile(self, arg) TypeError: not a string

selinplus commented 3 years ago

change config/erniesage_link_predict.yaml' ernie_name: "ernie-1.0"

ernie_name: "ernie-tiny"

suspend ernie no ernie-tiny model

HaoRan98 commented 3 years ago

Thanks 但是又出现了新的错误 Traceback (most recent call last): File "link_predict.py", line 272, in predict(config) File "link_predict.py", line 230, in predict predict_ds = Dataset.from_generator_func(predict_iter) File "/home/alphis/ws/pei_zhi_huan_jing/ERNIE/propeller/data/functional.py", line 278, in from_generator_func raise ValueError('expect generator function, got %s' % repr(_gen)) 还是配置文件的问题么?

WeiyueSu commented 3 years ago

更新一下pip install -U paddle-propeller,升级为最新版本

bmfarer commented 3 years ago

你好,我在运行示例的时候遇到以下错误, paddle版本:2.0.0rc pgl版本:1.2.1 ---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in 11 inputs = L.data("inputs", [2], False, 'int64') 12 ---> 13 gw = BatchGraphWrapper(num_nodes, num_edges, edges, {"term_ids": node_feat}) 14 outputs = erniesage_v2_encoder([gw], [inputs]) 15 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in init(self, num_nodes, num_edges, edges, node_feats, edge_feats) 829 self._edge_uniq_dst_count = L.concat([uniq_count, last]) 830 self._edge_uniq_dst_count.stop_gradient = True --> 831 self._indegree = get_degree(self._edges_dst, self._num_nodes) 832 833 def __build_meta_data(self, num_nodes, num_edges): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in get_degree(edge, num_nodes) 729 init_output, 730 edge, --> 731 L.full_like( 732 edge, 1, dtype="float32"), 733 overwrite=False) AttributeError: module 'paddle.fluid.layers' has no attribute 'full_like'

请问这得怎么解决呀?

ZHUI commented 3 years ago

你好,我在运行示例的时候遇到以下错误, paddle版本:2.0.0rc pgl版本:1.2.1 ---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in 11 inputs = L.data("inputs", [2], False, 'int64') 12 ---> 13 gw = BatchGraphWrapper(num_nodes, num_edges, edges, {"term_ids": node_feat}) 14 outputs = erniesage_v2_encoder([gw], [inputs]) 15 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in init(self, num_nodes, num_edges, edges, node_feats, edge_feats) 829 self._edge_uniq_dst_count = L.concat([uniq_count, last]) 830 self._edge_uniq_dst_count.stop_gradient = True --> 831 self._indegree = get_degree(self._edges_dst, self._num_nodes) 832 833 def __build_meta_data(self, num_nodes, num_edges): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in get_degree(edge, num_nodes) 729 init_output, 730 edge, --> 731 L.full_like( 732 edge, 1, dtype="float32"), 733 overwrite=False) AttributeError: module 'paddle.fluid.layers' has no attribute 'full_like'

请问这得怎么解决呀?

同学您好,基于PGL 2.0全新动态图版本,PaddleNLP将erniesage迁移至动态图。欢迎试用动态图版本,更加方便debug,更易用。 https://github.com/PaddlePaddle/PaddleNLP/tree/develop/examples/text_graph/erniesage 同时,PGL的erniesage 2.0也在开发中,敬请期待。

randomtutu commented 3 years ago

一点都不简单可依赖,楼主咨询报错,回复让试试2.0。

randomtutu commented 3 years ago

你好,我在运行示例的时候遇到以下错误, paddle版本:2.0.0rc pgl版本:1.2.1 ---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in 11 inputs = L.data("inputs", [2], False, 'int64') 12 ---> 13 gw = BatchGraphWrapper(num_nodes, num_edges, edges, {"term_ids": node_feat}) 14 outputs = erniesage_v2_encoder([gw], [inputs]) 15 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in init(self, num_nodes, num_edges, edges, node_feats, edge_feats) 829 self._edge_uniq_dst_count = L.concat([uniq_count, last]) 830 self._edge_uniq_dst_count.stop_gradient = True --> 831 self._indegree = get_degree(self._edges_dst, self._num_nodes) 832 833 def __build_meta_data(self, num_nodes, num_edges): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in get_degree(edge, num_nodes) 729 init_output, 730 edge, --> 731 L.full_like( 732 edge, 1, dtype="float32"), 733 overwrite=False) AttributeError: module 'paddle.fluid.layers' has no attribute 'full_like'

请问这得怎么解决呀?

paddle1.7没有这个api,升级1.8及其以上就可以了。主页上的依赖有一点问题。

l-i-p-f commented 2 years ago

你好,我在运行示例的时候遇到以下错误, paddle版本:2.0.0rc pgl版本:1.2.1 ---------------------------------------------------------------------------AttributeError Traceback (most recent call last) in 11 inputs = L.data("inputs", [2], False, 'int64') 12 ---> 13 gw = BatchGraphWrapper(num_nodes, num_edges, edges, {"term_ids": node_feat}) 14 outputs = erniesage_v2_encoder([gw], [inputs]) 15 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in init(self, num_nodes, num_edges, edges, node_feats, edge_feats) 829 self._edge_uniq_dst_count = L.concat([uniq_count, last]) 830 self._edge_uniq_dst_count.stop_gradient = True --> 831 self._indegree = get_degree(self._edges_dst, self._num_nodes) 832 833 def __build_meta_data(self, num_nodes, num_edges): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/pgl/graph_wrapper.py in get_degree(edge, num_nodes) 729 init_output, 730 edge, --> 731 L.full_like( 732 edge, 1, dtype="float32"), 733 overwrite=False) AttributeError: module 'paddle.fluid.layers' has no attribute 'full_like'

请问这得怎么解决呀?

参考Paddle 1.8 与 Paddle 2.0 API映射表 新版本api有变动,你用的2.x版本,可以改报错文件的源码,将:

L.full_like(

改为:

import paddle
paddle.full_like(