X2Paddle icon indicating copy to clipboard operation
X2Paddle copied to clipboard

在pytorch模型转换到paddle模型。运行官方程序出现这个错误怎么解决

Open Craw-B opened this issue 2 years ago • 1 comments

===================Error Information=============== Traceback (most recent call last): File "D:/Program Code/pythonProject/x2paddle/main.py", line 15, in pytorch2paddle(torch_module, File "D:\Program Files\anaconda3\envs\pytorch_env\lib\site-packages\x2paddle\convert.py", line 240, in pytorch2paddle mapper.paddle_graph.gen_model(save_dir, jit_type=jit_type) File "D:\Program Files\anaconda3\envs\pytorch_env\lib\site-packages\x2paddle\core\program.py", line 240, in gen_model self.gen_dygraph_model(save_dir, jit_type) File "D:\Program Files\anaconda3\envs\pytorch_env\lib\site-packages\x2paddle\core\program.py", line 298, in gen_dygraph_model raise e File "D:\Program Files\anaconda3\envs\pytorch_env\lib\site-packages\x2paddle\core\program.py", line 294, in gen_dygraph_model self.dygraph2static(save_dir, input_shapes, input_types) File "D:\Program Files\anaconda3\envs\pytorch_env\lib\site-packages\x2paddle\core\program.py", line 637, in dygraph2static import x2paddle_code File "pd_model_trace\x2paddle_code.py", line 80 params = paddle.load('D:\Program Code\pythonProject\x2paddle\pd_model_trace/model.pdparams') ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 29-31: truncated \xXX escape

Process finished with exit code 1

Craw-B avatar Mar 08 '22 14:03 Craw-B

@Craw-B 看起来像是windows路径问题,应该在路径前加一个r,git clone最新的X2Paddle代码,输入下列命令

pip uninstall x2paddle
cd X2Paddle
python setup.py install

麻烦做一下这个问卷:https://iwenjuan.baidu.com/?code=npyd51

感谢~

wjj19950828 avatar Mar 09 '22 02:03 wjj19950828