运行app.py时出现error calling function,报错信息如下:
192.168.160.211 - - [24/Oct/2023 15:11:15] "GET / HTTP/1.1" 200 -
192.168.160.211 - - [24/Oct/2023 15:11:15] "GET /static/res/hd2.jpg HTTP/1.1" 404 -
Building prefix dict from the default dictionary ...
Loading model from cache C:\Users\86181\AppData\Local\Temp\jieba.cache
Loading model cost 0.654 seconds.
Prefix dict has been built successfully.
[2023-10-24 15:11:19,667] ERROR in app: Exception on /message [POST]
Traceback (most recent call last):
File "D:\Anaconda\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "D:\Anaconda\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "D:\Anaconda\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\86181\Desktop\Seq2SeqChatbot\web\app.py", line 43, in reply
res_msg = execute.predict(req_msg)
File "C:\Users\86181\Desktop\Seq2SeqChatbot\execute.py", line 124, in predict
checkpoint=torch.load(checkpoint_prefix)
File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 771, in load
with _open_file_like(f, 'rb') as opened_file:
File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 270, in _open_file_like
return _open_file(name_or_buffer, mode)
File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 251, in init
super(_open_file, self).init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'model_data.pt'
192.168.160.211 - - [24/Oct/2023 15:11:19] "POST /message HTTP/1.1" 500 -
运行app.py时出现error calling function,报错信息如下: 192.168.160.211 - - [24/Oct/2023 15:11:15] "GET / HTTP/1.1" 200 - 192.168.160.211 - - [24/Oct/2023 15:11:15] "GET /static/res/hd2.jpg HTTP/1.1" 404 - Building prefix dict from the default dictionary ... Loading model from cache C:\Users\86181\AppData\Local\Temp\jieba.cache Loading model cost 0.654 seconds. Prefix dict has been built successfully. [2023-10-24 15:11:19,667] ERROR in app: Exception on /message [POST] Traceback (most recent call last): File "D:\Anaconda\lib\site-packages\flask\app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "D:\Anaconda\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "D:\Anaconda\lib\site-packages\flask\app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "D:\Anaconda\lib\site-packages\flask_compat.py", line 39, in reraise raise value File "D:\Anaconda\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "D:\Anaconda\lib\site-packages\flask\app.py", line 1936, in dispatch_request return self.view_functionsrule.endpoint File "C:\Users\86181\Desktop\Seq2SeqChatbot\web\app.py", line 43, in reply res_msg = execute.predict(req_msg) File "C:\Users\86181\Desktop\Seq2SeqChatbot\execute.py", line 124, in predict checkpoint=torch.load(checkpoint_prefix) File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 771, in load with _open_file_like(f, 'rb') as opened_file: File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 270, in _open_file_like return _open_file(name_or_buffer, mode) File "D:\Anaconda\lib\site-packages\torch\serialization.py", line 251, in init super(_open_file, self).init(open(name, mode)) FileNotFoundError: [Errno 2] No such file or directory: 'model_data.pt' 192.168.160.211 - - [24/Oct/2023 15:11:19] "POST /message HTTP/1.1" 500 -
请问是'model_data.pt'存在问题吗,或者说问题出在execute.py中predict函数的checkpoint=torch.load(checkpoint_prefix)语句? 后面的报错"POST /message HTTP/1.1" 500 -指的是什么意思呢? 请问如何解决该问题?