Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行app.py时如下报错,是什么原因呢 #141

Open
sunyrain opened this issue Jul 29, 2022 · 4 comments
Open

运行app.py时如下报错,是什么原因呢 #141

sunyrain opened this issue Jul 29, 2022 · 4 comments

Comments

@sunyrain
Copy link

D:\anaco\python.exe D:/gitworks/chatbot-master/chatbot-master/Chatbot-tensowflow2.0/Seq2seqchatbot/web/app.py 2022-07-29 15:20:47.633892: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found 2022-07-29 15:20:47.633993: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. WARNING:tensorflow:From D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot\seq2seqModel.py:4: experimental_run_functions_eagerly (from tensorflow.python.eager.def_function) is deprecated and will be removed in a future version. Instructions for updating: Use tf.config.run_functions_eagerly` instead of the experimental version.
2022-07-29 15:20:49.307136: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-07-29 15:20:49.307255: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2022-07-29 15:20:49.309705: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: LAPTOP-UEUEEB6P
2022-07-29 15:20:49.309823: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: LAPTOP-UEUEEB6P
2022-07-29 15:20:49.310104: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot\web/train_data\seq.data
D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot/D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot\web/train_data\seq.data

  • Serving Flask app "app" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
  • Running on all addresses.
    WARNING: This is a development server. Do not use it in a production deployment.
  • Running on http://192.168.2.155:8808/ (Press CTRL+C to quit)
    192.168.2.155 - - [29/Jul/2022 15:21:01] "GET / HTTP/1.1" 200 -
    192.168.2.155 - - [29/Jul/2022 15:21:01] "GET /static/res/hd2.jpg HTTP/1.1" 404 -
    Building prefix dict from the default dictionary ...
    Loading model from cache C:\Users\WENJIE~1\AppData\Local\Temp\jieba.cache
    2
    Loading model cost 0.477 seconds.
    Prefix dict has been built successfully.
    C:\Users\WENJIE_2021\AppData\Roaming\Python\Python39\site-packages\numpy\core_asarray.py:83: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
    return array(a, dtype, copy=False, order=order)
    [2022-07-29 15:21:05,122] ERROR in app: Exception on /message [POST]
    TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "D:\anaco\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "D:\anaco\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\anaco\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "D:\anaco\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "D:\anaco\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "D:\anaco\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot\web\app.py", line 44, in reply
res_msg = execute.predict(req_msg)
File "D:\gitworks\chatbot-master\chatbot-master\Chatbot-tensowflow2.0\Seq2seqchatbot\execute.py", line 117, in predict
inputs = tf.keras.preprocessing.sequence.pad_sequences([inputs],maxlen=max_length_inp,padding='post')
File "C:\Users\WENJIE_2021\AppData\Roaming\Python\Python39\site-packages\keras\preprocessing\sequence.py", line 152, in pad_sequences
return sequence.pad_sequences(
File "C:\Users\WENJIE_2021\AppData\Roaming\Python\Python39\site-packages\keras_preprocessing\sequence.py", line 98, in pad_sequences
trunc = np.asarray(trunc, dtype=dtype)
File "C:\Users\WENJIE_2021\AppData\Roaming\Python\Python39\site-packages\numpy\core_asarray.py", line 83, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: setting an array element with a sequence.
192.168.2.155 - - [29/Jul/2022 15:21:05] "POST /message HTTP/1.1" 500 -
2022-07-29 15:21:59 - heartbeat`

@sunyrain
Copy link
Author

新的后端报错
127.0.0.1 - - [31/Jul/2022 17:06:01] "POST /message HTTP/1.1" 500 - [2022-07-31 17:06:10,083] ERROR in app: Exception on /message [POST] Traceback (most recent call last): File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\_compat.py", line 39, in reraise raise value File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\wenjie\anaconda3\lib\site-packages\flask\app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "E:/Aiworks/Chatbot-tensowflow2.0/Seq2seqchatbot/web/app.py", line 43, in reply res_msg = execute.predict(req_msg) File "E:\Aiworks\Chatbot-tensowflow2.0\Seq2seqchatbot\execute.py", line 113, in predict inputs = tf.keras.preprocessing.sequence.pad_sequences([inputs],maxlen=max_length_inp,padding='post') File "C:\Users\wenjie\anaconda3\lib\site-packages\keras\utils\data_utils.py", line 1041, in pad_sequences trunc = np.asarray(trunc, dtype=dtype) File "C:\Users\wenjie\anaconda3\lib\site-packages\numpy\core\_asarray.py", line 102, in asarray return array(a, dtype, copy=False, order=order) ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (11,) + inhomogeneous part. 127.0.0.1 - - [31/Jul/2022 17:06:10] "POST /message HTTP/1.1" 500 - 2022-07-31 17:06:18 - heartbeat 2022-07-31 17:07:18 - heartbeat 2022-07-31 17:08:18 - heartbeat

@wxingheng
Copy link

一样报错

@TimVan1596
Copy link

同样的错误 setting an array element with a sequence.

@shirubei
Copy link

#152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants