ERNIE icon indicating copy to clipboard operation
ERNIE copied to clipboard

安装后第一次跑报AttributeError: 'WindowsPath' object has no attribute 'tell'

Open Daminan0919 opened this issue 3 years ago • 2 comments

应该是执行:model = ErnieModel.from_pretrained('ernie-1.0')时报如下错,windows中的pycharm里跑的,版本2.3.0

[INFO] 2022-05-20 14:36:48,313 [modeling_ernie.py: 267]: get pretrain dir from https://ernie-github.cdn.bcebos.com/model-ernie1.0.1.tar.gz [INFO] 2022-05-20 14:36:54,157 [modeling_ernie.py: 285]: loading pretrained model from C:\Users\xwhmajun.paddle-ernie-cache\466eabcffd6d6a83ae9cb97dd1a167bd Traceback (most recent call last): File "D:\anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in runfile('E:/telecom/telework/python/geekbangpython-master/geekbangpython-master/chinese_match/paddle_baidu.py', wdir='E:/telecom/telework/python/geekbangpython-master/geekbangpython-master/chinese_match') File "D:\Program Files\PyCharm 2020.1\plugins\python\helpers\pydev_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\Program Files\PyCharm 2020.1\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/telecom/telework/python/geekbangpython-master/geekbangpython-master/chinese_match/paddle_baidu.py", line 18, in model = ErnieModel.from_pretrained('ernie-1.0') File "D:\anaconda3\lib\site-packages\ernie\ernie\modeling_ernie.py", line 293, in from_pretrained m = P.load(state_dict_path) File "C:\Users\xwhmajun\AppData\Roaming\Python\Python39\site-packages\paddle\framework\io.py", line 947, in load with _open_file_buffer(path, 'rb') as f: File "C:\Users\xwhmajun\AppData\Roaming\Python\Python39\site-packages\paddle\fluid\io.py", line 111, in _open_file_buffer return _buffer_reader(path_or_buffer) File "C:\Users\xwhmajun\AppData\Roaming\Python\Python39\site-packages\paddle\fluid\io.py", line 86, in init self.initial_tell = self.buffer.tell() AttributeError: 'WindowsPath' object has no attribute 'tell'

Daminan0919 avatar May 20 '22 06:05 Daminan0919

可以参考一下 https://toscode.gitee.com/paddlepaddle/Paddle/issues/I4QBUH

webYFDT avatar Jul 05 '22 06:07 webYFDT

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reopen it. Thank you for your contributions.

stale[bot] avatar Sep 20 '22 18:09 stale[bot]