As mentioned in SAM-2 Issue 85, there are modules named "gamma" in SAM-2's memory encoder, which is conflict with transformers. (transformers forbid module names "gamma" or "beta")
To solve this problem, we manually rename "gamma" in SAM-2 modelscript to "weight". The checkpoint can be load properly because transformers api will rename "gamma" in state dict to "weight".
We believe it is rude to modify module name of others' models. Please tell us if you have any other better ways to solve this problem
As mentioned in SAM-2 Issue 85, there are modules named "gamma" in SAM-2's memory encoder, which is conflict with transformers. (transformers forbid module names "gamma" or "beta") To solve this problem, we manually rename "gamma" in SAM-2 modelscript to "weight". The checkpoint can be load properly because transformers api will rename "gamma" in state dict to "weight".
We believe it is rude to modify module name of others' models. Please tell us if you have any other better ways to solve this problem