AttributeError: 'RecursiveScriptModule' object has no attribute 'copy'
See original GitHub issueI want to ask a question about “AttributeError: ‘RecursiveScriptModule’ object has no attribute ‘copy’”
the following are my coding:
`(base) ubuntu@ubuntu:~/BM/BackgroundMattingV2$ python inference_video.py \
--model-type mattingrefine \ --model-backbone resnet50 \ --model-backbone-scale 0.25 \ --model-refine-mode sampling \ --model-refine-sample-pixels 80000 \ --model-checkpoint "/home/ubuntu/BM/content/torchscript_resnet50_fp32.pth" \ --video-src "/content/src.mp4" \ --video-bgr "/content/bgr.png" \ --output-dir "/content/output/" \ --output-type com fgr pha err ref
/home/ubuntu/anaconda3/envs/modnet_offline_3/lib/python3.6/site-packages/torch/serialization.py:589: UserWarning: ‘torch.load’ received a zip file that looks like a TorchScript archive dispatching to ‘torch.jit.load’ (call ‘torch.jit.load’ directly to silence this warning) " silence this warning)", UserWarning) Traceback (most recent call last): File “inference_video.py”, line 130, in <module> model.load_state_dict(torch.load(args.model_checkpoint, map_location=device), strict=False) File “/home/ubuntu/anaconda3/envs/modnet_offline_3/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 1196, in load_state_dict state_dict = state_dict.copy() File “/home/ubuntu/anaconda3/envs/modnet_offline_3/lib/python3.6/site-packages/torch/jit/_script.py”, line 561, in getattr return super(RecursiveScriptModule, self).getattr(attr) File “/home/ubuntu/anaconda3/envs/modnet_offline_3/lib/python3.6/site-packages/torch/jit/_script.py”, line 291, in getattr return super(ScriptModule, self).getattr(attr) File “/home/ubuntu/anaconda3/envs/modnet_offline_3/lib/python3.6/site-packages/torch/nn/modules/module.py”, line 948, in getattr type(self).name, name)) AttributeError: ‘RecursiveScriptModule’ object has no attribute ‘copy’ (base) ubuntu@ubuntu:~/BM/BackgroundMattingV2$ `
my environment is cuda11.1,pytorch 1.8.0, GEFORCE RTX 3090, and I suspect it’s a problem with the pytorch version? I
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Related StackOverflow Question
好的呢,哥哥
------------------ 原始邮件 ------------------ 发件人: "Peter @.>; 发送时间: 2021年5月12日(星期三) 下午4:26 收件人: @.>; 抄送: "Microsoft @.>; @.>; 主题: Re: [PeterL1n/BackgroundMattingV2] AttributeError: 'RecursiveScriptModule' object has no attribute 'copy' (#93)
亲,跟你讲了,你这行错了 –model-checkpoint “/home/ubuntu/BM/content/torchscript_resnet50_fp32.pth” \ 你不应该下载torchscript_resnet50_fp32.pth,要换成pytorch_resnet50.pth。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
亲,跟你讲了,你这行错了
你不应该下载
torchscript_resnet50_fp32.pth,要换成pytorch_resnet50.pth。