Lazy_Coder
Lazy_Coder

Reputation: 1

getting unexpected keys error while loading weights

import torch
from PIL import Image
import numpy as np
from effdet import get_efficientdet_config, EfficientDet


config = get_efficientdet_config('tf_efficientdet_d0')
model = EfficientDet(config, pretrained_backbone=True)
model.eval()

when I run this I am getting the error

Unexpected keys (bn2.bias, bn2.num_batches_tracked, bn2.running_mean, bn2.running_var, bn2.weight, classifier.bias, classifier.weight, conv_head.weight) found while loading pretrained weights. This may be expected if model is being adapted.

I researched some bit and got to know that this is because of timm builder but didn't find any solutions. How to fix this?

I wanted to load the efficientdet weights but it resulted in an unexpected keys error

Upvotes: 0

Views: 55

Answers (1)

ndrwnaguib
ndrwnaguib

Reputation: 6115

Your code works without issues in my environment; I believe your huggingface_hub package is old. Try

python -m pip install --upgrade huggingface_hub

Upvotes: 0

Related Questions