CLUEbenchmark / FewCLUE

FewCLUE 小样本学习测评基准,中文版
https://arxiv.org/abs/2107.07498
492 stars 72 forks source link

baseline/models_keras/ptuning_origin #19

Open Torres9999 opened 2 years ago

Torres9999 commented 2 years ago

运行这个文件,会报错'NoneType' object has no attribute '_inbound_nodes'。 Traceback (most recent call last): File "/home/xuwei/Downloads/pycharm-professional-2021.3.3/pycharm-2021.3.3/plugins/python/helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/xuwei/Downloads/pycharm-professional-2021.3.3/pycharm-2021.3.3/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/xuwei/Downloads/FewCLUE-main/baselines/models_keras/ptuning_origin/ptuning_sentiment.py", line 135, in model, train_model = get_model(pattern_len=unused_length, trainable=True, lr=3e-5) File "/home/xuwei/Downloads/FewCLUE-main/baselines/models_keras/ptuning_origin/modeling.py", line 154, in get_model model = build_transformer_model( File "/home/xuwei/anaconda3/lib/python3.8/site-packages/bert4keras/models.py", line 2441, in build_transformer_model transformer.build(configs) File "/home/xuwei/anaconda3/lib/python3.8/site-packages/bert4keras/models.py", line 96, in build self.model = Model(self.inputs, self.outputs, name=self.name) File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, *kwargs) File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 94, in init self._init_graph_network(args, kwargs) File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 240, in _init_graph_network nodes, nodes_by_depth, layers, layers_by_depth = _map_graph_network( File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 1431, in _map_graph_network build_map(x, finished_nodes, nodes_in_progress, File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 1420, in build_map build_map(x, finished_nodes, nodes_in_progress, layer, File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 1420, in build_map build_map(x, finished_nodes, nodes_in_progress, layer, File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 1420, in build_map build_map(x, finished_nodes, nodes_in_progress, layer, [Previous line repeated 50 more times] File "/home/xuwei/anaconda3/lib/python3.8/site-packages/keras/engine/network.py", line 1393, in build_map node = layer._inbound_nodes[node_index] AttributeError: 'NoneType' object has no attribute '_inbound_nodes' python-BaseException 能否修复下

Armorhtk commented 2 years ago

我也遇到了相同的问题 按照README中的要求添加export TF_KERAS=1 (需要使用tf作为后端)后解决报错 export代码如下:

import os os.environ["TF_KERAS"] = '1'