421872919 发表于 2021-4-16 10:34:31

运行机器翻译程序出现报错问题,恳请大佬帮看看解决一下

大佬们,小弟找了一个机器翻译的程序,跑的时候出现了以下报错情况,错误太多了,已经无法分析了,请各位大佬们帮我看看这主要是什么问题,该怎么解决呢?



C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\Scripts\python.exe E:/AI/project_five/机器翻译/untitled17/transformer1.py
2021-04-16 10:23:09.062648: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
100%|██████████| 100/100
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\Lenovo\AppData\Local\Temp\jieba.cache
Loading model cost 1.039 seconds.
Prefix dict has been built successfully.
100%|██████████| 100/100
100%|██████████| 100/100
100%|██████████| 100/100
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
* https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
* https://github.com/tensorflow/addons
* https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:228: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:240: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:245: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:97: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:255: dropout (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.dropout instead.
WARNING:tensorflow:From C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\layers\core.py:271: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.__call__` method instead.
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:130: dense (from tensorflow.python.layers.core) is deprecated and will be removed in a future version.
Instructions for updating:
Use keras.layers.Dense instead.
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:151: 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 E:/AI/project_five/机器翻译/untitled17/transformer1.py:198: conv1d (from tensorflow.python.layers.convolutional) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.keras.layers.Conv1D` instead.
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:322: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:323: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.cast` instead.
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:326: The name tf.summary.scalar is deprecated. Please use tf.compat.v1.summary.scalar instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:336: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:341: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:366: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:367: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2021-04-16 10:23:26.044444: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2021-04-16 10:23:26.480745: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 950M major: 5 minor: 0 memoryClockRate(GHz): 1.124
pciBusID: 0000:01:00.0
2021-04-16 10:23:26.481169: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2021-04-16 10:23:26.487305: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2021-04-16 10:23:26.491740: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2021-04-16 10:23:26.493764: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2021-04-16 10:23:26.590343: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2021-04-16 10:23:26.594972: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2021-04-16 10:23:26.620456: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-04-16 10:23:26.632548: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2021-04-16 10:23:26.633151: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2021-04-16 10:23:26.641009: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 950M major: 5 minor: 0 memoryClockRate(GHz): 1.124
pciBusID: 0000:01:00.0
2021-04-16 10:23:26.641432: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2021-04-16 10:23:26.641714: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2021-04-16 10:23:26.643928: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2021-04-16 10:23:26.644280: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2021-04-16 10:23:26.644745: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2021-04-16 10:23:26.645054: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2021-04-16 10:23:26.645356: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-04-16 10:23:26.658255: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2021-04-16 10:23:28.819656: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-16 10:23:28.820018: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2021-04-16 10:23:28.820218: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2021-04-16 10:23:28.832070: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3039 MB memory) -> physical GPU (device: 0, name: GeForce GTX 950M, pci bus id: 0000:01:00.0, compute capability: 5.0)
WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:369: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:372: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.

WARNING:tensorflow:From E:/AI/project_five/机器翻译/untitled17/transformer1.py:372: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

0%|          | 0/2 2021-04-16 10:23:40.304046: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2021-04-16 10:23:40.666340: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2021-04-16 10:23:41.787671: E tensorflow/stream_executor/cuda/cuda_dnn.cc:319] Loaded runtime CuDNN library: 7.5.0 but source was compiled with: 7.6.0.CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library.If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2021-04-16 10:23:41.790838: E tensorflow/stream_executor/cuda/cuda_dnn.cc:319] Loaded runtime CuDNN library: 7.5.0 but source was compiled with: 7.6.0.CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library.If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
0%|          | 0/2
Traceback (most recent call last):
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call
    return fn(*args)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn
    target_list, run_metadata)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
       [[{{node encoder/multihead_attention/conv1d/conv1d}}]]
       []
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
       [[{{node encoder/multihead_attention/conv1d/conv1d}}]]
0 successful operations.
0 derived errors ignored.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "E:/AI/project_five/机器翻译/untitled17/transformer1.py", line 380, in <module>
    cost,_ = sess.run(, feed_dict=feed)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 956, in run
    run_metadata_ptr)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1180, in _run
    feed_dict_tensor, options, run_metadata)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1359, in _do_run
    run_metadata)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\client\session.py", line 1384, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
       []
       []
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
       []
0 successful operations.
0 derived errors ignored.

Original stack trace for 'encoder/multihead_attention/conv1d/conv1d':
File "E:/AI/project_five/机器翻译/untitled17/transformer1.py", line 364, in <module>
    g = Graph(arg)
File "E:/AI/project_five/机器翻译/untitled17/transformer1.py", line 272, in __init__
    self.enc = feedforward(self.enc, num_units=)
File "E:/AI/project_five/机器翻译/untitled17/transformer1.py", line 198, in feedforward
    outputs = tf.layers.conv1d(**params)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\layers\convolutional.py", line 218, in conv1d
    return layer.apply(inputs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 1700, in apply
    return self.__call__(inputs, *args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\layers\base.py", line 548, in __call__
    outputs = super(Layer, self).__call__(inputs, *args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 854, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\autograph\impl\api.py", line 234, in wrapper
    return converted_call(f, options, args, kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\autograph\impl\api.py", line 439, in converted_call
    return _call_unconverted(f, args, kwargs, options)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\autograph\impl\api.py", line 330, in _call_unconverted
    return f(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\keras\layers\convolutional.py", line 387, in call
    return super(Conv1D, self).call(inputs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\keras\layers\convolutional.py", line 197, in call
    outputs = self._convolution_op(inputs, self.kernel)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\nn_ops.py", line 1134, in __call__
    return self.conv_op(inp, filter)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\nn_ops.py", line 639, in __call__
    return self.call(inp, filter)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\nn_ops.py", line 238, in __call__
    name=self.name)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\nn_ops.py", line 227, in _conv1d
    name=name)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 574, in new_func
    return func(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 574, in new_func
    return func(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\nn_ops.py", line 1681, in conv1d
    name=name)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\ops\gen_nn_ops.py", line 1071, in conv2d
    data_format=data_format, dilations=dilations, name=name)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\framework\op_def_library.py", line 794, in _apply_op_helper
    op_def=op_def)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3357, in create_op
    attrs, op_def, compute_device)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\framework\ops.py", line 3426, in _create_op_internal
    op_def=op_def)
File "C:\Users\Lenovo\.virtualenvs\python_env2-n0pMt24E\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1748, in __init__
    self._traceback = tf_stack.extract_stack()

yuxijian2020 发表于 2021-4-16 11:29:03

(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.

核心错误就这一个,获取卷积算法失败
每次出现这句时,下面都跟着一句提示 -- 你可能是因为哪个警告造成的,慢慢改就哦了

[]
页: [1]
查看完整版本: 运行机器翻译程序出现报错问题,恳请大佬帮看看解决一下