'Why do I get the error: ZeroDivisionError: 0.0 cannot be raised to a negative power error when loading deit model from Timm
I am trying to make inference on the DeiT small variant from timm.
from timm.models import create_model
model = create_model('deit_small_patch16_224', pretrained=True)
But I get the error:
self.scale = head_dim ** -0.5
ZeroDivisionError: 0.0 cannot be raised to a negative power.
However, creating a different model with model = create_model('deit_tiny_patch16_224', pretrained=True), I can make inference successfully and it works pretty fine. I understand this error is as a result of a zero being divided by a non-zero value or when being raised to the power of non-zero. But I don't quite get why this model is flagging an error from timm even before loading any data.
Solution 1:[1]
It was an error with my version of timm. Upgrading timm: pip install --upgrade timm solved the problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Craving_gold |
