首页 PaddleHub 帖子详情
本地调用paddlehub预训练模型出错
收藏
快速回复
PaddleHub 问答预训练模型 2982 18
本地调用paddlehub预训练模型出错
收藏
快速回复
PaddleHub 问答预训练模型 2982 18

版本: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]

0
收藏
回复
全部评论(18)
时间顺序
嘿嘿一笑abc
#2 回复于2020-08

求大佬解答

0
回复
嘿嘿一笑abc
#3 回复于2020-08

已解决 

0
回复
加洲帝中
#4 回复于2020-08

请问怎么解决的呀?

 

0
回复
c
chf0818
#5 回复于2020-08

怎么解决这问题啊  

0
回复
怪人狂人
#6 回复于2020-08

请问这个问题是怎么解决的呀,感激不尽

0
回复
thinc
#7 回复于2020-08

应该是中文路径问题

0
回复
怪人狂人
#8 回复于2020-08
thinc #7
应该是中文路径问题

请问您指的是预训练模型存放的那个c盘的路径吗

0
回复
thinc
#9 回复于2020-08
请问您指的是预训练模型存放的那个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来说经常出问题,可以试下换成英文后会不会报错

0
回复
lianzhang132
#10 回复于2020-08

估计就是 路径问题

0
回复
AIStudio810258
#11 回复于2020-08

可能是因为字符集的原因,好多程序运行的报错都是因为路径中有中文,或超过长度限制

0
回复
thinc
#12 回复于2020-08
可能是因为字符集的原因,好多程序运行的报错都是因为路径中有中文,或超过长度限制

对对,路径太长了也会出问题,os真让人头大

0
回复
Mr.郑先生_
#13 回复于2020-08

我也是这个问题!

0
回复
Mr.郑先生_
#14 回复于2020-08
已解决 

大佬是怎么解决的?

0
回复
朗园01
#15 回复于2020-12
已解决 

咋解决这个问题哈,我也遇到了

0
回复
thinc
#16 回复于2020-12
朗园01 #15
咋解决这个问题哈,我也遇到了

把你的中文路径改成英文

0
回复
小峰l_
#17 回复于2021-01

路径是英文还是有问题啊

 

0
回复
a
ad撒大苏打
#18 回复于2021-04

怎么解决的啊

 

0
回复
向上跌了一跤99
#19 回复于2022-08

只改路径就可以了是吗

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户