hecongqing / CCKS2019_EventEntityExtraction_Rank5

SEBERTNets:一种面向金融领域的事件主体抽取方法
194 stars 41 forks source link

复现遇见了问题 #6

Open Xiongzhiyu opened 2 years ago

Xiongzhiyu commented 2 years ago

朋友,我想复现你的代码,始终报错AttributeError:` 'tuple' object has no attribute 'layer',我想是keras或者tensorflow版本问题之类的,但是我的tensorflow==1.14.0,keras==2.2.4,keras_bert==0.69。

下面是python console: Using TensorFlow backend. 2022-03-15 17:08:49.172897: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA 2022-03-15 17:08:49.183220: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100000000 Hz 2022-03-15 17:08:49.185943: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x557d590d8fb0 executing computations on platform Host. Devices: 2022-03-15 17:08:49.185966: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): , 2022-03-15 17:08:49.187178: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcuda.so.1 2022-03-15 17:08:49.199418: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1640] Found device 0 with properties: name: GeForce RTX 2080 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.545 pciBusID: 0000:1e:00.0 2022-03-15 17:08:49.199647: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 2022-03-15 17:08:49.201180: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcublas.so.10.0 2022-03-15 17:08:49.202479: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcufft.so.10.0 2022-03-15 17:08:49.202802: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcurand.so.10.0 2022-03-15 17:08:49.204694: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusolver.so.10.0 2022-03-15 17:08:49.206051: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcusparse.so.10.0 2022-03-15 17:08:49.210302: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudnn.so.7 2022-03-15 17:08:49.212597: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1763] Adding visible gpu devices: 0 2022-03-15 17:08:49.212653: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.0 2022-03-15 17:08:49.355199: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1181] Device interconnect StreamExecutor with strength 1 edge matrix: 2022-03-15 17:08:49.355240: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1187] 0 2022-03-15 17:08:49.355247: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1200] 0: N 2022-03-15 17:08:49.358488: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1326] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7957 MB memory) -> physical GPU (device: 0, name: GeForce RTX 2080 Ti, pci bus id: 0000:1e:00.0, compute capability: 7.5) 2022-03-15 17:08:49.360436: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x557d5caf6710 executing computations on platform CUDA. Devices: 2022-03-15 17:08:49.360459: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): GeForce RTX 2080 Ti, Compute Capability 7.5 kFlod 0 / 10 WARNING:tensorflow:From /root/miniconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. WARNING:tensorflow:From /root/miniconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead. WARNING:tensorflow:From /root/miniconda3/lib/python3.7/site-packages/tensorflow/python/keras/initializers.py:119: calling RandomUniform.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor Traceback (most recent call last): File "/root/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3437, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in runfile('/root/PycharmProjects/src/SEBERT_model.py', wdir='/root/PycharmProjects/src') File "/root/.pycharm_helpers/pydev/_pydev_bundle/pydev_umd.py", line 198, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "/root/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/root/PycharmProjects/src/SEBERT_model.py", line 456, in model, train_model = modify_bert_model_3() File "/root/PycharmProjects/src/SEBERT_model.py", line 241, in modify_bert_model_3 bert_model = load_trained_model_from_checkpoint(config_path, checkpoint_path) File "/root/miniconda3/lib/python3.7/site-packages/keras_bert/loader.py", line 182, in load_trained_model_from_checkpoint adapter_units=adapter_units, File "/root/miniconda3/lib/python3.7/site-packages/keras_bert/loader.py", line 62, in build_model_from_config adapter_units=adapter_units, File "/root/miniconda3/lib/python3.7/site-packages/keras_bert/bert.py", line 105, in get_model dropout_rate=dropout_rate, File "/root/miniconda3/lib/python3.7/site-packages/keras_bert/layers/embedding.py", line 56, in get_embedding )(embed_layer) File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 663, in call inputs, outputs, args, kwargs) File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1708, in _set_connectivitymetadata input_tensors=inputs, output_tensors=outputs, arguments=kwargs) File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1795, in _add_inbound_node input_tensors) File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/util/nest.py", line 515, in map_structure structure[0], [func(x) for x in entries], File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/util/nest.py", line 515, in structure[0], [func(x) for x in entries], File "/root/miniconda3/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 1794, in inbound_layers = nest.map_structure(lambda t: t._keras_history.layer, AttributeError: 'tuple' object has no attribute 'layer'

Menki123 commented 2 years ago

您好,铁子我复现遇到了同样的问题,您有解决办法了嘛

Xiongzhiyu commented 2 years ago

您好,铁子我复现遇到了同样的问题,您有解决办法了嘛

你解决了吗。。。。。

Menki123 commented 2 years ago

哎没有 还是那个问题。我把tensorflow环境什么的都改了一下,还是不行,报错的问题和这个不一样,但也是卡死了解决不了。

------------------ 原始邮件 ------------------ 发件人: "hecongqing/CCKS2019_EventEntityExtraction_Rank5" @.>; 发送时间: 2022年3月18日(星期五) 下午3:58 @.>; @.**@.>; 主题: Re: [hecongqing/CCKS2019_EventEntityExtraction_Rank5] 复现遇见了问题 (Issue #6)

您好,铁子我复现遇到了同样的问题,您有解决办法了嘛

你解决了吗。。。。。

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

hecongqing commented 2 years ago

keras-bert==0.69.0 这个库是对的吗

hecongqing commented 2 years ago

太久远了,我的机器已经没有这个环境了

hecongqing commented 2 years ago

已经更新了,现在可以运行了