版本:paddlepaddle 1.8.3 paddlehub 1.7.1
代码:
import paddlehub as hub
if __name__ == '__main__':
#导入模块
module = hub.Module(name='ernie_tiny')
print("ok")
报错:
[2020-08-07 12:38:10,942] [ INFO] - Installing ernie_tiny module
Downloading ernie_tiny
[==================================================] 100.00%
Uncompress C:\Users\森森\.paddlehub\tmp\tmp4c1jsg7h\ernie_tiny
[==================================================] 100.00%
[2020-08-07 12:39:46,433] [ INFO] - Successfully installed ernie_tiny-1.1.0
E:\Python37\lib\site-packages\paddle\fluid\executor.py:1070: UserWarning: The following exception is not an EOF exception.
"The following exception is not an EOF exception.")
Traceback (most recent call last):
File "E:/NLProbot/start.py", line 9, in
module = hub.Module(name='ernie_tiny')
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 102, in __new__
name=name, version=version, **kwargs)
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 178, in init_with_name
return cls.init_with_directory(directory=module_dir[0], **kwargs)
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 200, in init_with_directory
user_module = _item(directory=directory, **kwargs)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 286, in __init__
max_seq_len=max_seq_len)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 402, in context
exe, self.params_path, main_program=module_program)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 321, in init_pretraining_params
predicate=existed_params)
File "E:\Python37\lib\site-packages\paddle\fluid\io.py", line 751, in load_vars
filename=filename)
File "E:\Python37\lib\site-packages\paddle\fluid\io.py", line 805, in load_vars
executor.run(load_prog)
File "E:\Python37\lib\site-packages\paddle\fluid\executor.py", line 1071, in run
six.reraise(*sys.exc_info())
File "E:\Python37\lib\site-packages\six.py", line 703, in reraise
raise value
File "E:\Python37\lib\site-packages\paddle\fluid\executor.py", line 1066, in run
return_merged=return_merged)
File "E:\Python37\lib\site-packages\paddle\fluid\executor.py", line 1154, in _run_impl
use_program_cache=use_program_cache)
File "E:\Python37\lib\site-packages\paddle\fluid\executor.py", line 1229, in _run_program
fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet:
--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
Windows not support stack backtrace yet.
------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
File "E:\Python37\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op
attrs=kwargs.get("attrs", None))
File "E:\Python37\lib\site-packages\paddle\fluid\io.py", line 785, in load_vars
attrs={'file_path': os.path.join(dirname, new_var.name)})
File "E:\Python37\lib\site-packages\paddle\fluid\io.py", line 751, in load_vars
filename=filename)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 321, in init_pretraining_params
predicate=existed_params)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 402, in context
exe, self.params_path, main_program=module_program)
File "E:\Python37\lib\site-packages\paddlehub\module\nlp_module.py", line 286, in __init__
max_seq_len=max_seq_len)
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 200, in init_with_directory
user_module = _item(directory=directory, **kwargs)
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 178, in init_with_name
return cls.init_with_directory(directory=module_dir[0], **kwargs)
File "E:\Python37\lib\site-packages\paddlehub\module\module.py", line 102, in __new__
name=name, version=version, **kwargs)
File "E:/NLProbot/start.py", line 9, in
module = hub.Module(name='ernie_tiny')
----------------------
Error Message Summary:
----------------------
UnavailableError: Load operator fail to open file C:\Users\森森\.paddlehub\modules\ernie_tiny\assets\params\@HUB_ernie-tiny@word_embedding, please check whether the model file is complete or damaged.
[Hint: Expected static_cast(fin) == true, but received static_cast(fin):0 != true:1.] at (D:\1.8.3\paddle\paddle/fluid/operators/load_op.h:41)
[operator < load > error]
求大佬解答
已解决
请问怎么解决的呀?
怎么解决这问题啊
请问这个问题是怎么解决的呀,感激不尽
应该是中文路径问题
请问您指的是预训练模型存放的那个c盘的路径吗
UnavailableError: Load operator fail to open file C:\Users\森森\.paddlehub\modules\ernie_tiny\assets\params\@HUB_ernie-tiny@word_embedding, please check whether the model file is complete or damaged.
中文地址对win来说经常出问题,可以试下换成英文后会不会报错
估计就是 路径问题
可能是因为字符集的原因,好多程序运行的报错都是因为路径中有中文,或超过长度限制
对对,路径太长了也会出问题,os真让人头大
我也是这个问题!
大佬是怎么解决的?
咋解决这个问题哈,我也遇到了
把你的中文路径改成英文
路径是英文还是有问题啊
怎么解决的啊
只改路径就可以了是吗