IrisRainbowNeko / genshin_auto_fish

基于深度强化学习的原神自动钓鱼AI
4.76k stars 725 forks source link

在启动时报错:RuntimeError: Error(s) in loading state_dict for YOLOX: #312

Closed junguoqianshan closed 1 year ago

junguoqianshan commented 1 year ago

(ysfish) PS C:\Users\Grove Yo\genshin_auto_fish> python fishing.py image -f yolox/exp/yolox_tiny_fish.py -c weights/best_tiny3.pth --conf 0.25 --nms 0.45 --tsize 640 --device cpu 2022-10-11 15:58:21.598 | INFO | main:main:91 - Args: Namespace(demo='image', experiment_name='yolox_tiny_fish', name=None, path='./assets/dog.jpg', exp_file='yolox/exp/yolox_tiny_fish.py', ckpt='weights/best_tiny3.pth', device='cpu', conf=0.25, nms=0.45, tsize=640, fp16=False, legacy=False, fuse=False, trt=False, n_states=3, n_actions=2, step_tick=12, model_dir='./weights/fish_genshin_net.pth') 2022-10-11 15:58:21.775 | INFO | main:main:101 - Model Summary: Params: 5.03M, Gflops: 15.24 2022-10-11 15:58:21.776 | INFO | main:main:114 - loading checkpoint Traceback (most recent call last): File "C:\Users\Grove Yo\genshin_auto_fish\fishing.py", line 215, in main(exp, args) File "C:\Users\Grove Yo\genshin_auto_fish\fishing.py", line 117, in main model.load_state_dict(ckpt["model"]) File "C:\Users\Grove Yo.conda\envs\ysfish\lib\site-packages\torch\nn\modules\module.py", line 1223, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for YOLOX: size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]). size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]). size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]). size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]). size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([80, 96, 1, 1]) from checkpoint, the shape in current model is torch.Size([6, 96, 1, 1]). size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([6]).

junguoqianshan commented 1 year ago

finished