Guwen-UNILM icon indicating copy to clipboard operation
Guwen-UNILM copied to clipboard

guwenbert-tf报错问题

Open JiaxinQin0814 opened this issue 2 years ago • 9 comments

完整的报错如下: 他显示我的数组越界?我使用的数据和模型和参数和仓库中是一样的 而且我只有使用guwenbert的时候会碰到这样子的问题,其他时间并不会 WARNING:tensorflow:From D:\anoconda\envs\python3.7\lib\site-packages\tensorflow_core\python\ops\math_grad.py:1424: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:From D:\anoconda\envs\python3.7\lib\site-packages\keras\backend\tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

Epoch 1/15 3685 Traceback (most recent call last): File "D:\anoconda\envs\python3.7\lib\site-packages\keras\engine\training_generator.py", line 220, in fit_generator reset_metrics=False) File "D:\anoconda\envs\python3.7\lib\site-packages\keras\engine\training.py", line 1514, in train_on_batch outputs = self.train_function(ins) File "D:\anoconda\envs\python3.7\lib\site-packages\tensorflow_core\python\keras\backend.py", line 3476, in call run_metadata=self.run_metadata) File "D:\anoconda\envs\python3.7\lib\site-packages\tensorflow_core\python\client\session.py", line 1472, in call run_metadata_ptr) tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[28,96] = 1 is not in [0, 1) [[{{node Embedding-Segment/embedding_lookup}}]] python-BaseException

JiaxinQin0814 avatar Sep 20 '22 06:09 JiaxinQin0814

bert和roberta跑起来是好的嘛?

cloudyskyy avatar Sep 20 '22 07:09 cloudyskyy

是的,我用其他的几个模型都是可以的,只有guwenbert不可以

JiaxinQin0814 avatar Sep 20 '22 15:09 JiaxinQin0814

能否提供一下你的代码环境,包括python版本、GPU型号以及各种库的版本

cloudyskyy avatar Sep 21 '22 13:09 cloudyskyy

能否提供一下你的代码环境,包括python版本、GPU型号以及各种库的版本

你好python版本是3.7,使用的是cpu跑的,然后其他模型可以跑,但是使用下载提供的转化后的百度网盘guwen也显示如上错误

以下是版本 absl-py==1.4.0 astor==0.8.1 asynctest==0.13.0 bert4keras==0.11.1 blinker==1.4 brotlipy==0.7.0 cycler==0.11.0 fonttools==4.38.0 gast==0.2.2 grpcio==1.51.3 h5py==2.10.0 importlib-metadata==6.0.0 Keras==2.3.1 kiwisolver==1.4.4 MarkupSafe==2.1.2 matplotlib==3.5.3 mkl-fft==1.3.1 mkl-service==2.4.0 numpy==1.21.6 packaging==23.0 Pillow==9.4.0 protobuf==3.20.3 pyasn1-modules==0.2.8 pyparsing==3.0.9 python-dateutil==2.8.2 PyYAML==6.0 requests-oauthlib==1.3.0 tensorboard==1.15.0 tensorflow-estimator==1.15.1 tensorflow-gpu==1.15.0 termcolor==2.2.0 typing_extensions==4.5.0 Werkzeug==2.2.3 wincertstore==0.2 zipp==3.14.0

LeohAYU avatar Feb 25 '23 06:02 LeohAYU

你好,我也遇到了这个问题,请问有解决方法了吗?

kouyitian avatar Feb 28 '23 12:02 kouyitian

能否提供一下你的代码环境,包括python版本、GPU型号以及各种库的版本

你好python版本是3.7,使用的是cpu跑的,然后其他模型可以跑,但是使用下载提供的转化后的百度网盘guwen也显示如上错误

以下是版本 absl-py==1.4.0 astor==0.8.1 asynctest==0.13.0 bert4keras==0.11.1 blinker==1.4 brotlipy==0.7.0 cycler==0.11.0 fonttools==4.38.0 gast==0.2.2 grpcio==1.51.3 h5py==2.10.0 importlib-metadata==6.0.0 Keras==2.3.1 kiwisolver==1.4.4 MarkupSafe==2.1.2 matplotlib==3.5.3 mkl-fft==1.3.1 mkl-service==2.4.0 numpy==1.21.6 packaging==23.0 Pillow==9.4.0 protobuf==3.20.3 pyasn1-modules==0.2.8 pyparsing==3.0.9 python-dateutil==2.8.2 PyYAML==6.0 requests-oauthlib==1.3.0 tensorboard==1.15.0 tensorflow-estimator==1.15.1 tensorflow-gpu==1.15.0 termcolor==2.2.0 typing_extensions==4.5.0 Werkzeug==2.2.3 wincertstore==0.2 zipp==3.14.0

您好,我注意到这个issue了,并且尝试复现您的问题,发现确实在TensorFlow-CPU环境下无法运行guwenbert-tf模型。奇怪的是,使用GPU的时候是可以正常运行的。 image image

一旦安装为tensorflow-cpu版本,会报相同的错:

image

我目前的判断是tf,keras,以及bert4keras版本不兼容的问题。但是我尝试了一段时间暂时也没找到好的解决办法,没有找到一个正常的组合。这是一个很奇怪的只存在于CPU环境的报错,后续我会尽量找到cpu环境出错的原因。但无论如何还是建议您先使用TensorFlow-gpu运行代码。毕竟使用cpu的训练速度也远不及gpu。

cloudyskyy avatar Feb 28 '23 14:02 cloudyskyy

你好,我也遇到了这个问题,请问有解决方法了吗?

您好,请参考https://github.com/cloudyskyy/Guwen-UNILM/issues/5#issuecomment-1448235752。

简而言之我目前的判断是这是一个很奇怪的只存在于cpu环境的报错,发现确实在tensorflow-cpu环境下无法运行guwenbert-tf模型。但是,我的另一个观察是使用tensorflow-gpu的时候是可以正常运行的。初步判断是tf,keras,以及bert4keras版本不兼容的问题。我目前的建议是您先使用tensorflow-gpu运行代码。后续我会尽量找出原因。

cloudyskyy avatar Feb 28 '23 14:02 cloudyskyy

你好,我也遇到了这个问题,请问有解决方法了吗?

您好,请参考https://github.com/cloudyskyy/Guwen-UNILM/issues/5#issuecomment-1448235752。

简而言之我目前的判断是这是一个很奇怪的只存在于cpu环境的报错,发现确实在tensorflow-cpu环境下无法运行guwenbert-tf模型。但是,我的另一个观察是使用tensorflow-gpu的时候是可以正常运行的。初步判断是tf,keras,以及bert4keras版本不兼容的问题。我目前的建议是您先使用tensorflow-gpu运行代码。后续我会尽量找出原因。

好的,非常感谢您的回复!

kouyitian avatar Mar 02 '23 01:03 kouyitian

您好,我想问一下我的警告信息如下: WARNING:tensorflow:From D:\Azyx\NLPfile\Guwen-UNILM-main\bert4keras\backend.py:200: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where 2023-07-17 14:32:36.597407: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll 2023-07-17 14:32:36.632785: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: name: NVIDIA RTX A4000 major: 8 minor: 6 memoryClockRate(GHz): 1.56 pciBusID: 0000:01:00.0 2023-07-17 14:32:36.633082: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found 2023-07-17 14:32:36.633268: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_100.dll'; dlerror: cublas64_100.dll not found 2023-07-17 14:32:36.633439: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_100.dll'; dlerror: cufft64_100.dll not found 2023-07-17 14:32:36.633606: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_100.dll'; dlerror: curand64_100.dll not found 2023-07-17 14:32:36.633770: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_100.dll'; dlerror: cusolver64_100.dll not found 2023-07-17 14:32:36.633936: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_100.dll'; dlerror: cusparse64_100.dll not found 2023-07-17 14:32:36.634101: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found 2023-07-17 14:32:36.634171: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1641] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow t he guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... 2023-07-17 14:32:36.635202: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2023-07-17 14:32:36.636989: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix: 我的GPU是RTX A4000 cuda是11.7的版本,我之前运行其他项目的时候是可以使用GPU的。但是在运行这个项目的时候我换了虚拟环境,具体配置如下: Keras | 2.3.1 Keras-Applications | 1.0.8 Keras-Preprocessing | 1.1.2 Markdown | 3.4.3 MarkupSafe | 2.1.3 Pillow | 9.5.0 PyYAML | 6.0 | Werkzeug | 2.2.3 absl-py | 1.4.0 astor | 0.8.1 bert4keras | 0.11.1 cycler | 0.11.0 fonttools | 4.38.0 gast | 0.2.2 google-pasta | 0.2.0 grpcio | 1.54.2 h5py | 2.10.0 importlib-metadata | 6.6.0 kiwisolver | 1.4.4 matplotlib | 3.5.3 numpy | 1.21.6 opt-einsum | 3.3.0 packaging | 23.1 pip | 23.1.2 protobuf | 3.20.0 | pyparsing | 3.0.9 python-dateutil | 2.8.2 scipy | 1.7.3 setuptools | 57.0.0 six | 1.16.0 tensorboard | 1.15.0 tensorflow-estimator | 1.15.1 tensorflow-gpu | 1.15.0 termcolor | 2.3.0 typing-extensions | 4.6.3 wheel | 0.36.2 wrapt | 1.15.0 zipp | 3.15.0 在这个环境配置下本项目不管是Bert还是RoBERTa都只能使用CPU进行计算。 我的问题如下: 1:我看了这个warning应该就是说我缺少tensorflow-gpu | 1.15.0对应的CUDA 10.0的包对吗? 2:我现在用的是CUDA11.7 我能不能再下载一个CUDA 10.0的版本,我不知道是否兼容。 3:或者有什么其他办法可以解决我这个GPU不能使用的问题吗? 我是遇到了与前面那位一样的问题,我就没有guwenbert了,在使用RoBERTa的时候出现了无法使用GPU的情况

zhouyuxiang-66 avatar Jul 17 '23 08:07 zhouyuxiang-66