最近使用

fastai 來訓練

並且使用vision_learner的 SwinV2模型分類

但是卻顯示

 

running_mean should contain 24 elements not 3072

 

這很明顯是銜接 torch.batch_norm 時候參數錯誤導致

但是因為用 fastai 很難微調模型
因為 fastai 都是使用固定邏輯來修改調整模型
參數並不能客製太多

所以我找一找有找到這網頁

https://forums.fast.ai/t/road-to-the-top-part-3-running-mean-error-with-swin-models/106435

 

裡面提到:

Pinning the timm library to version 0.6.13 worked for me.

 

原本我的 timm 是 0.9.16

所以降版成 0.6.13

沒想到就可以了